diff options
author | Dmitry Kasatkin <d.kasatkin@samsung.com> | 2014-11-20 16:31:01 +0200 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2015-05-21 13:28:47 -0400 |
commit | 7c51bb00c40e5608fb2cdac5230f51aeb56a28df (patch) | |
tree | ea228d622a60f43812b50ce7e27b2abbb466f04b /fs/xattr.c | |
parent | 5101a1850bb7ccbf107929dee9af0cd2f400940f (diff) | |
download | linux-stable-7c51bb00c40e5608fb2cdac5230f51aeb56a28df.tar.gz linux-stable-7c51bb00c40e5608fb2cdac5230f51aeb56a28df.tar.bz2 linux-stable-7c51bb00c40e5608fb2cdac5230f51aeb56a28df.zip |
evm: fix potential race when removing xattrs
EVM needs to be atomically updated when removing xattrs.
Otherwise concurrent EVM verification may fail in between.
This patch fixes by moving i_mutex unlocking after calling
EVM hook. fsnotify_xattr() is also now called while locked
the same way as it is done in __vfs_setxattr_noperm.
Changelog:
- remove unused 'inode' variable.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r-- | fs/xattr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/xattr.c b/fs/xattr.c index 4ef698549e31..072fee1258dd 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -298,18 +298,18 @@ vfs_removexattr(struct dentry *dentry, const char *name) mutex_lock(&inode->i_mutex); error = security_inode_removexattr(dentry, name); - if (error) { - mutex_unlock(&inode->i_mutex); - return error; - } + if (error) + goto out; error = inode->i_op->removexattr(dentry, name); - mutex_unlock(&inode->i_mutex); if (!error) { fsnotify_xattr(dentry); evm_inode_post_removexattr(dentry, name); } + +out: + mutex_unlock(&inode->i_mutex); return error; } EXPORT_SYMBOL_GPL(vfs_removexattr); |