|
@@ -2708,6 +2708,7 @@ static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
|
|
|
{
|
|
|
const struct cred *cred = current_cred();
|
|
|
unsigned int ia_valid = iattr->ia_valid;
|
|
|
+ __u32 av = FILE__WRITE;
|
|
|
|
|
|
/* ATTR_FORCE is just used for ATTR_KILL_S[UG]ID. */
|
|
|
if (ia_valid & ATTR_FORCE) {
|
|
@@ -2721,7 +2722,10 @@ static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
|
|
|
ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_TIMES_SET))
|
|
|
return dentry_has_perm(cred, dentry, FILE__SETATTR);
|
|
|
|
|
|
- return dentry_has_perm(cred, dentry, FILE__WRITE);
|
|
|
+ if (ia_valid & ATTR_SIZE)
|
|
|
+ av |= FILE__OPEN;
|
|
|
+
|
|
|
+ return dentry_has_perm(cred, dentry, av);
|
|
|
}
|
|
|
|
|
|
static int selinux_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
|