Skip to content

Commit

Permalink
notify_change(): check that i_mutex is held
Browse files Browse the repository at this point in the history
Cc: Djalal Harouni <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
akpm00 authored and Al Viro committed Jul 14, 2012
1 parent b5fb63c commit c4107b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -250,5 +252,4 @@ int notify_change(struct dentry * dentry, struct iattr * attr)

return error;
}

EXPORT_SYMBOL(notify_change);

0 comments on commit c4107b3

Please sign in to comment.