Commit c4107b30 authored by Andrew Morton's avatar Andrew Morton Committed by Al Viro

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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent b5fb63c1
...@@ -171,6 +171,8 @@ int notify_change(struct dentry * dentry, struct iattr * attr) ...@@ -171,6 +171,8 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
struct timespec now; struct timespec now;
unsigned int ia_valid = attr->ia_valid; 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 (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) {
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM; return -EPERM;
...@@ -250,5 +252,4 @@ int notify_change(struct dentry * dentry, struct iattr * attr) ...@@ -250,5 +252,4 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
return error; return error;
} }
EXPORT_SYMBOL(notify_change); EXPORT_SYMBOL(notify_change);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment