always call inode_change_ok early in ->setattr
Make sure we call inode_change_ok before doing any changes in ->setattr, and make sure to call it even if our fs wants to ignore normal UNIX permissions, but use the ATTR_FORCE to skip those. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
committed by
Al Viro
parent
1025774ce4
commit
db78b877f7
@@ -3084,6 +3084,10 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
int depth;
|
||||
int error;
|
||||
|
||||
error = inode_change_ok(inode, attr);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/* must be turned off for recursive notify_change calls */
|
||||
ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
|
||||
|
||||
@@ -3133,10 +3137,6 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = inode_change_ok(inode, attr);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
|
||||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
|
||||
struct reiserfs_transaction_handle th;
|
||||
|
Reference in New Issue
Block a user