* [Ocfs2-devel] [PATCH] ocfs2: Add missing errno in ocfs2_ioctl_move_extents()
@ 2013-09-18 8:33 Younger Liu
2013-09-18 8:58 ` Dan Carpenter
2013-09-18 9:12 ` Jeff Liu
0 siblings, 2 replies; 3+ messages in thread
From: Younger Liu @ 2013-09-18 8:33 UTC (permalink / raw)
To: ocfs2-devel
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 <younger.liu@huawei.com>
Cc: Jie Liu <jeff.liu@oracle.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
---
fs/ocfs2/move_extents.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 3d3f3c8..0ef308d 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -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;
--
1.7.9.7
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Ocfs2-devel] [PATCH] ocfs2: Add missing errno in ocfs2_ioctl_move_extents()
2013-09-18 8:33 [Ocfs2-devel] [PATCH] ocfs2: Add missing errno in ocfs2_ioctl_move_extents() Younger Liu
@ 2013-09-18 8:58 ` Dan Carpenter
2013-09-18 9:12 ` Jeff Liu
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-09-18 8:58 UTC (permalink / raw)
To: ocfs2-devel
On Wed, Sep 18, 2013 at 04:33:13PM +0800, Younger Liu wrote:
> 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 <younger.liu@huawei.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Add missing errno in ocfs2_ioctl_move_extents()
2013-09-18 8:33 [Ocfs2-devel] [PATCH] ocfs2: Add missing errno in ocfs2_ioctl_move_extents() Younger Liu
2013-09-18 8:58 ` Dan Carpenter
@ 2013-09-18 9:12 ` Jeff Liu
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2013-09-18 9:12 UTC (permalink / raw)
To: ocfs2-devel
On 09/18/2013 04:33 PM, Younger Liu wrote:
> 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 <younger.liu@huawei.com>
> Cc: Jie Liu <jeff.liu@oracle.com>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> fs/ocfs2/move_extents.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
> index 3d3f3c8..0ef308d 100644
> --- a/fs/ocfs2/move_extents.c
> +++ b/fs/ocfs2/move_extents.c
> @@ -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;
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-18 9:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 8:33 [Ocfs2-devel] [PATCH] ocfs2: Add missing errno in ocfs2_ioctl_move_extents() Younger Liu
2013-09-18 8:58 ` Dan Carpenter
2013-09-18 9:12 ` Jeff Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.