summaryrefslogtreecommitdiff
path: root/fs/attr.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2012-06-20 09:55:58 +1000
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 16:35:42 +0400
commitc4107b3097465e25f7d6a9b0ac0518b07b24e774 (patch)
tree55586999886b01a548608936ca58ccd038604235 /fs/attr.c
parentb5fb63c18315c5510c1d0636179c057e0c761c77 (diff)
downloadlwn-c4107b3097465e25f7d6a9b0ac0518b07b24e774.tar.gz
lwn-c4107b3097465e25f7d6a9b0ac0518b07b24e774.zip
notify_change(): check that i_mutex is held
Cc: Djalal Harouni <tixxdz@opendz.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/attr.c')
-rw-r--r--fs/attr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/attr.c b/fs/attr.c
index 0da90951d277..29e38a1f7f77 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -171,6 +171,8 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
struct timespec now;
unsigned int ia_valid = attr->ia_valid;
+ WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex));
+
if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) {
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
@@ -250,5 +252,4 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
return error;
}
-
EXPORT_SYMBOL(notify_change);