aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorYounger Liu <younger.liu@huawei.com>2013-11-12 18:07:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:02 -0500
commitbfbca926d67c9bf3212d1077c6afd48d2995a285 (patch)
tree84b4717ceef6ab721d527e6a8706b9bd02eeda51 /fs/ocfs2
parent8abaae8d85d4e1de0fcc81b733ba04a5d318ba7a (diff)
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 <younger.liu@huawei.com> Signed-off-by: Jie Liu <jeff.liu@oracle.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Jie Liu <jeff.liu@oracle.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Mark Fasheh <mfasheh@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/move_extents.c8
1 files changed, 6 insertions, 2 deletions
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)
1066 if (status) 1066 if (status)
1067 return status; 1067 return status;
1068 1068
1069 if ((!S_ISREG(inode->i_mode)) || !(filp->f_mode & FMODE_WRITE)) 1069 if ((!S_ISREG(inode->i_mode)) || !(filp->f_mode & FMODE_WRITE)) {
1070 status = -EPERM;
1070 goto out_drop; 1071 goto out_drop;
1072 }
1071 1073
1072 if (inode->i_flags & (S_IMMUTABLE|S_APPEND)) { 1074 if (inode->i_flags & (S_IMMUTABLE|S_APPEND)) {
1073 status = -EPERM; 1075 status = -EPERM;
@@ -1089,8 +1091,10 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
1089 goto out_free; 1091 goto out_free;
1090 } 1092 }
1091 1093
1092 if (range.me_start > i_size_read(inode)) 1094 if (range.me_start > i_size_read(inode)) {
1095 status = -EINVAL;
1093 goto out_free; 1096 goto out_free;
1097 }
1094 1098
1095 if (range.me_start + range.me_len > i_size_read(inode)) 1099 if (range.me_start + range.me_len > i_size_read(inode))
1096 range.me_len = i_size_read(inode) - range.me_start; 1100 range.me_len = i_size_read(inode) - range.me_start;