summaryrefslogtreecommitdiffstats
path: root/fs/xattr.c
diff options
context:
space:
mode:
authorMimi Zohar2011-03-23 22:23:06 +0100
committerMimi Zohar2012-09-07 20:57:27 +0200
commit2ab51f3721f7abdf92d89cb79d3d6c0062ddc14b (patch)
tree75ffb5798218e106f20560ca9b13a17924cb77c9 /fs/xattr.c
parentYama: handle 32-bit userspace prctl (diff)
downloadkernel-qcow2-linux-2ab51f3721f7abdf92d89cb79d3d6c0062ddc14b.tar.gz
kernel-qcow2-linux-2ab51f3721f7abdf92d89cb79d3d6c0062ddc14b.tar.xz
kernel-qcow2-linux-2ab51f3721f7abdf92d89cb79d3d6c0062ddc14b.zip
vfs: extend vfs_removexattr locking
This patch takes the i_mutex lock before security_inode_removexattr(), instead of after, in preparation of calling ima_inode_removexattr(). Signed-off-by: Mimi Zohar <zohar@us.ibm.com> Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r--fs/xattr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index 4d45b7189e7e..107f457143c3 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -295,11 +295,13 @@ vfs_removexattr(struct dentry *dentry, const char *name)
if (error)
return error;
+ mutex_lock(&inode->i_mutex);
error = security_inode_removexattr(dentry, name);
- if (error)
+ if (error) {
+ mutex_unlock(&inode->i_mutex);
return error;
+ }
- mutex_lock(&inode->i_mutex);
error = inode->i_op->removexattr(dentry, name);
mutex_unlock(&inode->i_mutex);