mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
1025774ce4
commit
db78b877f7
6 changed files with 48 additions and 48 deletions
10
mm/shmem.c
10
mm/shmem.c
|
|
@ -767,6 +767,10 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
|
|||
loff_t newsize = attr->ia_size;
|
||||
int error;
|
||||
|
||||
error = inode_change_ok(inode, attr);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)
|
||||
&& newsize != inode->i_size) {
|
||||
struct page *page = NULL;
|
||||
|
|
@ -809,11 +813,9 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
|
|||
shmem_truncate_range(inode, newsize, (loff_t)-1);
|
||||
}
|
||||
|
||||
error = inode_change_ok(inode, attr);
|
||||
if (!error)
|
||||
setattr_copy(inode, attr);
|
||||
setattr_copy(inode, attr);
|
||||
#ifdef CONFIG_TMPFS_POSIX_ACL
|
||||
if (!error && (attr->ia_valid & ATTR_MODE))
|
||||
if (attr->ia_valid & ATTR_MODE)
|
||||
error = generic_acl_chmod(inode);
|
||||
#endif
|
||||
return error;
|
||||
|
|
|
|||
Loading…
Reference in a new issue