Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157333
b: refs/heads/master
c: bc6a600
h: refs/heads/master
i:
  157331: 55206fa
v: v3
  • Loading branch information
Amerigo Wang authored and James Morris committed Aug 21, 2009
1 parent 67ea60a commit 9a97d55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ece13879e74313e62109e0755dd3d4f172df89e2
refs/heads/master: bc6a6008e5e3c7a30191a7f19ab19e85b14b1705
16 changes: 11 additions & 5 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2711,12 +2711,18 @@ static int selinux_inode_permission(struct inode *inode, int mask)
static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
{
const struct cred *cred = current_cred();
unsigned int ia_valid = iattr->ia_valid;

/* ATTR_FORCE is just used for ATTR_KILL_S[UG]ID. */
if (ia_valid & ATTR_FORCE) {
ia_valid &= ~(ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_MODE |
ATTR_FORCE);
if (!ia_valid)
return 0;
}

if (iattr->ia_valid & ATTR_FORCE)
return 0;

if (iattr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
ATTR_ATIME_SET | ATTR_MTIME_SET))
if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_TIMES_SET))
return dentry_has_perm(cred, NULL, dentry, FILE__SETATTR);

return dentry_has_perm(cred, NULL, dentry, FILE__WRITE);
Expand Down

0 comments on commit 9a97d55

Please sign in to comment.