mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -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
|
|
@ -387,21 +387,6 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
unsigned int ia_valid;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Expand the file. Since inode_setattr() updates ->i_size
|
||||
* before calling the ->truncate(), but FAT needs to fill the
|
||||
* hole before it. XXX: this is no longer true with new truncate
|
||||
* sequence.
|
||||
*/
|
||||
if (attr->ia_valid & ATTR_SIZE) {
|
||||
if (attr->ia_size > inode->i_size) {
|
||||
error = fat_cont_expand(inode, attr->ia_size);
|
||||
if (error || attr->ia_valid == ATTR_SIZE)
|
||||
goto out;
|
||||
attr->ia_valid &= ~ATTR_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for setting the inode time. */
|
||||
ia_valid = attr->ia_valid;
|
||||
if (ia_valid & TIMES_SET_FLAGS) {
|
||||
|
|
@ -417,6 +402,21 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand the file. Since inode_setattr() updates ->i_size
|
||||
* before calling the ->truncate(), but FAT needs to fill the
|
||||
* hole before it. XXX: this is no longer true with new truncate
|
||||
* sequence.
|
||||
*/
|
||||
if (attr->ia_valid & ATTR_SIZE) {
|
||||
if (attr->ia_size > inode->i_size) {
|
||||
error = fat_cont_expand(inode, attr->ia_size);
|
||||
if (error || attr->ia_valid == ATTR_SIZE)
|
||||
goto out;
|
||||
attr->ia_valid &= ~ATTR_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
if (((attr->ia_valid & ATTR_UID) &&
|
||||
(attr->ia_uid != sbi->options.fs_uid)) ||
|
||||
((attr->ia_valid & ATTR_GID) &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue