diff options
author | From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2014-05-05 03:30:20 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-05-05 03:30:20 -0400 |
commit | b28fd7b5fe232d7643d7c0595938e998ceb58508 (patch) | |
tree | 13ecd856c65c33998ba458f54d0bf5674630e904 /fs/xfs/xfs_ioctl32.c | |
parent | 3c353375761d81abfb66eb054aacceef31658e24 (diff) |
xfs: Fix wrong error codes being returned
xfs_{compat_,}attrmulti_by_handle could return an errno with incorrect
sign in some cases. While at it, make sure ENOMEM is returned instead of
E2BIG if kmalloc fails.
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_ioctl32.c')
-rw-r--r-- | fs/xfs/xfs_ioctl32.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index a7992f8de9d3..944d5baa710a 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c | |||
@@ -424,10 +424,11 @@ xfs_compat_attrmulti_by_handle( | |||
424 | 424 | ||
425 | ops = memdup_user(compat_ptr(am_hreq.ops), size); | 425 | ops = memdup_user(compat_ptr(am_hreq.ops), size); |
426 | if (IS_ERR(ops)) { | 426 | if (IS_ERR(ops)) { |
427 | error = PTR_ERR(ops); | 427 | error = -PTR_ERR(ops); |
428 | goto out_dput; | 428 | goto out_dput; |
429 | } | 429 | } |
430 | 430 | ||
431 | error = ENOMEM; | ||
431 | attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); | 432 | attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); |
432 | if (!attr_name) | 433 | if (!attr_name) |
433 | goto out_kfree_ops; | 434 | goto out_kfree_ops; |
@@ -438,7 +439,7 @@ xfs_compat_attrmulti_by_handle( | |||
438 | compat_ptr(ops[i].am_attrname), | 439 | compat_ptr(ops[i].am_attrname), |
439 | MAXNAMELEN); | 440 | MAXNAMELEN); |
440 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) | 441 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) |
441 | error = -ERANGE; | 442 | error = ERANGE; |
442 | if (ops[i].am_error < 0) | 443 | if (ops[i].am_error < 0) |
443 | break; | 444 | break; |
444 | 445 | ||