notify_change(): check that i_mutex is held
authorAndrew Morton <akpm@linux-foundation.org>
Tue, 19 Jun 2012 23:55:58 +0000 (09:55 +1000)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 14 Jul 2012 12:35:42 +0000 (16:35 +0400)
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>
fs/attr.c

index 0da90951d2776f827a905337938399ada79e8e69..29e38a1f7f77a15100f1d20b3e51507470273633 100644 (file)
--- 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);