Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157299
b: refs/heads/master
c: 20dda18
h: refs/heads/master
i:
  157297: 44c3df6
  157295: fa4b475
v: v3
  • Loading branch information
Stephen Smalley authored and James Morris committed Jun 22, 2009
1 parent 5a8f15c commit 7a54cb9
Show file tree
Hide file tree
Showing 2 changed files with 11 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: 56f8c9bc410deb55f21698e6a0d59f559ae1d794
refs/heads/master: 20dda18be9035c487c2e9534e4d18d2a1e1deade
15 changes: 10 additions & 5 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2938,11 +2938,6 @@ static int selinux_revalidate_file_permission(struct file *file, int mask)
const struct cred *cred = current_cred();
struct inode *inode = file->f_path.dentry->d_inode;

if (!mask) {
/* No permission to check. Existence test. */
return 0;
}

/* file_mask_to_av won't add FILE__WRITE if MAY_APPEND is set */
if ((file->f_flags & O_APPEND) && (mask & MAY_WRITE))
mask |= MAY_APPEND;
Expand All @@ -2953,10 +2948,20 @@ static int selinux_revalidate_file_permission(struct file *file, int mask)

static int selinux_file_permission(struct file *file, int mask)
{
struct inode *inode = file->f_path.dentry->d_inode;
struct file_security_struct *fsec = file->f_security;
struct inode_security_struct *isec = inode->i_security;
u32 sid = current_sid();

if (!mask)
/* No permission to check. Existence test. */
return 0;

if (sid == fsec->sid && fsec->isid == isec->sid &&
fsec->pseqno == avc_policy_seqno())
/* No change since dentry_open check. */
return 0;

return selinux_revalidate_file_permission(file, mask);
}

Expand Down

0 comments on commit 7a54cb9

Please sign in to comment.