File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -2711,12 +2711,18 @@ static int selinux_inode_permission(struct inode *inode, int mask)
2711
2711
static int selinux_inode_setattr (struct dentry * dentry , struct iattr * iattr )
2712
2712
{
2713
2713
const struct cred * cred = current_cred ();
2714
+ unsigned int ia_valid = iattr -> ia_valid ;
2715
+
2716
+ /* ATTR_FORCE is just used for ATTR_KILL_S[UG]ID. */
2717
+ if (ia_valid & ATTR_FORCE ) {
2718
+ ia_valid &= ~(ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_MODE |
2719
+ ATTR_FORCE );
2720
+ if (!ia_valid )
2721
+ return 0 ;
2722
+ }
2714
2723
2715
- if (iattr -> ia_valid & ATTR_FORCE )
2716
- return 0 ;
2717
-
2718
- if (iattr -> ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
2719
- ATTR_ATIME_SET | ATTR_MTIME_SET ))
2724
+ if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
2725
+ ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_TIMES_SET ))
2720
2726
return dentry_has_perm (cred , NULL , dentry , FILE__SETATTR );
2721
2727
2722
2728
return dentry_has_perm (cred , NULL , dentry , FILE__WRITE );
You can’t perform that action at this time.
0 commit comments