提交 bfbca926 编写于 作者: Y Younger Liu 提交者: Linus Torvalds

ocfs2: add missing errno in ocfs2_ioctl_move_extents()

If the file is not regular or writeable, it should return errno(EPERM).

This patch is based on 85a258b7 ("ocfs2: fix error handling in
ocfs2_ioctl_move_extents()").
Signed-off-by: NYounger Liu <younger.liu@huawei.com>
Signed-off-by: NJie Liu <jeff.liu@oracle.com>
Reviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NJie Liu <jeff.liu@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 8abaae8d
......@@ -1066,8 +1066,10 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
if (status)
return status;
if ((!S_ISREG(inode->i_mode)) || !(filp->f_mode & FMODE_WRITE))
if ((!S_ISREG(inode->i_mode)) || !(filp->f_mode & FMODE_WRITE)) {
status = -EPERM;
goto out_drop;
}
if (inode->i_flags & (S_IMMUTABLE|S_APPEND)) {
status = -EPERM;
......@@ -1089,8 +1091,10 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
goto out_free;
}
if (range.me_start > i_size_read(inode))
if (range.me_start > i_size_read(inode)) {
status = -EINVAL;
goto out_free;
}
if (range.me_start + range.me_len > i_size_read(inode))
range.me_len = i_size_read(inode) - range.me_start;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册