Skip to contentSkip to conversation

ocfs2: Add missing errno in ocfs2_ioctl_move_extents()

PATCH New Younger Liu 2 participants 2 messages Sep 18, 2013 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 commit 85a258b70d4891a443583530f48ab734a31e2d8d.

---
 fs/ocfs2/move_extents.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ocfs2/move_extents.c +6 -2
index 3d3f3c8..9385fa8 100644
@@ -1067,8 +1067,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;
@@ -1090,8 +1092,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;
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH v2 1/1 ocfs2: Add missing errno in ocfs2_ioctl_move_extents()

Quoted 7 lines · Younger Liu

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

This patch is based on commit 85a258b70d4891a443583530f48ab734a31e2d8d.

Looks good to me, thanks.
(BTW, there is no need to add my SOB because I'm not in patch submission path :)).

Quoted 33 lines
---
 fs/ocfs2/move_extents.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ocfs2/move_extents.c +6 -3
index 3d3f3c8..9385fa8 100644
@@ -1067,8 +1067,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;
@@ -1090,8 +1092,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;
-- 1.7.9.7