vfs: extend vfs_removexattr locking
authorMimi Zohar <zohar@linux.vnet.ibm.com>
Wed, 23 Mar 2011 21:23:06 +0000 (17:23 -0400)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Fri, 7 Sep 2012 18:57:27 +0000 (14:57 -0400)
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>
fs/xattr.c

index 4d45b7189e7eaa352da0567b8fe4a2d1b738c999..107f457143c35ffbcb9ad39ae52815a81332fcec 100644 (file)
@@ -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);