Skip to content

Commit

Permalink
vfs: extend vfs_removexattr locking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mimi Zohar committed Sep 7, 2012
1 parent 2e4930e commit 2ab51f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2ab51f3

Please sign in to comment.