diff options
author | Christoph Hellwig <hch@lst.de> | 2009-01-18 20:03:03 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2009-01-18 22:44:30 -0500 |
commit | 62e194ecdaf8a1935991c1f8704886328d96a391 (patch) | |
tree | 730e1c02ece82443f3dbe1314b88763bee4764d2 /fs | |
parent | ab596ad8972f314ace538799734c7e1bdd1da2ff (diff) |
xfs: use mnt_want_write in compat_attrmulti ioctl
The compat version of the attrmulti ioctl needs to ask for and then
later release write access to the mount just like the native version,
otherwise we could potentially write to read-only mounts.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index fd4362063f25..c70c4e3db790 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include <linux/compat.h> | 18 | #include <linux/compat.h> |
19 | #include <linux/ioctl.h> | 19 | #include <linux/ioctl.h> |
20 | #include <linux/mount.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include "xfs.h" | 22 | #include "xfs.h" |
22 | #include "xfs_fs.h" | 23 | #include "xfs_fs.h" |
@@ -458,15 +459,23 @@ xfs_compat_attrmulti_by_handle( | |||
458 | &ops[i].am_length, ops[i].am_flags); | 459 | &ops[i].am_length, ops[i].am_flags); |
459 | break; | 460 | break; |
460 | case ATTR_OP_SET: | 461 | case ATTR_OP_SET: |
462 | ops[i].am_error = mnt_want_write(parfilp->f_path.mnt); | ||
463 | if (ops[i].am_error) | ||
464 | break; | ||
461 | ops[i].am_error = xfs_attrmulti_attr_set( | 465 | ops[i].am_error = xfs_attrmulti_attr_set( |
462 | dentry->d_inode, attr_name, | 466 | dentry->d_inode, attr_name, |
463 | compat_ptr(ops[i].am_attrvalue), | 467 | compat_ptr(ops[i].am_attrvalue), |
464 | ops[i].am_length, ops[i].am_flags); | 468 | ops[i].am_length, ops[i].am_flags); |
469 | mnt_drop_write(parfilp->f_path.mnt); | ||
465 | break; | 470 | break; |
466 | case ATTR_OP_REMOVE: | 471 | case ATTR_OP_REMOVE: |
472 | ops[i].am_error = mnt_want_write(parfilp->f_path.mnt); | ||
473 | if (ops[i].am_error) | ||
474 | break; | ||
467 | ops[i].am_error = xfs_attrmulti_attr_remove( | 475 | ops[i].am_error = xfs_attrmulti_attr_remove( |
468 | dentry->d_inode, attr_name, | 476 | dentry->d_inode, attr_name, |
469 | ops[i].am_flags); | 477 | ops[i].am_flags); |
478 | mnt_drop_write(parfilp->f_path.mnt); | ||
470 | break; | 479 | break; |
471 | default: | 480 | default: |
472 | ops[i].am_error = EINVAL; | 481 | ops[i].am_error = EINVAL; |