ocfs2: Add missing errno in ocfs2_ioctl_move_extents()
PATCH 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/move_extents.c +3 -1
@@ -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 ;
Signature · 1 line
1.7.9.7
PATCH 1/1 ocfs2: Add missing errno in ocfs2_ioctl_move_extents()
Quoted 5 lines · Younger Liu
If the file is not regular or writeable, it should return errno(-EPERM).
This patch is based on commit
85a258b70d4891a443583530f48ab734a31e2d8d.Signed-off-by Younger Liu <[email protected]>
regards,
dan carpenter
PATCH 1/1 ocfs2: Add missing errno in ocfs2_ioctl_move_extents()
In reply to Younger LiuQuoted 17 lines · Younger Liu
If the file is not regular or writeable, it should return errno(-EPERM).
This patch is based on commit
85a258b70d4891a443583530f48ab734a31e2d8d.Signed-off-by Younger Liu <[email protected]>Cc Jie Liu <[email protected]>Cc Dan Carpenter <[email protected]>--- fs/ocfs2/move_extents.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ocfs2/move_extents.c +0
-0@@ -1067,8 +1067,10 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)if (status)
fs/ocfs2/move_extents.c int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp) · line 1076
Quoted 10 lines
fs/ocfs2/move_extents.c +3
-1return 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 ;
This fix looks good, but we should also return an meaningful errno if the defragment start offset is larger than the file size in this function, i.e,
- if (range.me_start > i_size_read(inode))
+ if (range.me_start > i_size_read(inode)) {
+ status = -EINVAL;
goto out_free;+ }
Thanks,
-Jeff