From: Younger Liu Date: Tue, 12 Nov 2013 23:07:05 +0000 (-0800) Subject: ocfs2: add missing errno in ocfs2_ioctl_move_extents() X-Git-Tag: firefly_0821_release~176^2~4993^2~250 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bfbca926d67c9bf3212d1077c6afd48d2995a285;p=firefly-linux-kernel-4.4.55.git 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 85a258b70d ("ocfs2: fix error handling in ocfs2_ioctl_move_extents()"). Signed-off-by: Younger Liu Signed-off-by: Jie Liu Reviewed-by: Dan Carpenter Reviewed-by: Jie Liu Cc: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 445678d9163c..631a98213474 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c @@ -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;