Commit 19e49834d22c2271ed1f4a03aaa4b74986447fb4

Authored by Linus Torvalds
1 parent 15c83d26e1

selinux: remove 'flags' parameter from inode_has_perm

Every single user passes in '0'.  I think we had non-zero users back in
some stone age when selinux_inode_permission() was implemented in terms
of inode_has_perm(), but that complicated case got split up into a
totally separate code-path so that we could optimize the much simpler
special cases.

See commit 2e33405785d3 ("SELinux: delay initialization of audit data in
selinux_inode_permission") for example.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 6 additions and 7 deletions Side-by-side Diff

security/selinux/hooks.c
... ... @@ -1525,8 +1525,7 @@
1525 1525 static int inode_has_perm(const struct cred *cred,
1526 1526 struct inode *inode,
1527 1527 u32 perms,
1528   - struct common_audit_data *adp,
1529   - unsigned flags)
  1528 + struct common_audit_data *adp)
1530 1529 {
1531 1530 struct inode_security_struct *isec;
1532 1531 u32 sid;
... ... @@ -1539,7 +1538,7 @@
1539 1538 sid = cred_sid(cred);
1540 1539 isec = inode->i_security;
1541 1540  
1542   - return avc_has_perm_flags(sid, isec->sid, isec->sclass, perms, adp, flags);
  1541 + return avc_has_perm(sid, isec->sid, isec->sclass, perms, adp);
1543 1542 }
1544 1543  
1545 1544 /* Same as inode_has_perm, but pass explicit audit data containing
... ... @@ -1554,7 +1553,7 @@
1554 1553  
1555 1554 ad.type = LSM_AUDIT_DATA_DENTRY;
1556 1555 ad.u.dentry = dentry;
1557   - return inode_has_perm(cred, inode, av, &ad, 0);
  1556 + return inode_has_perm(cred, inode, av, &ad);
1558 1557 }
1559 1558  
1560 1559 /* Same as inode_has_perm, but pass explicit audit data containing
... ... @@ -1569,7 +1568,7 @@
1569 1568  
1570 1569 ad.type = LSM_AUDIT_DATA_PATH;
1571 1570 ad.u.path = *path;
1572   - return inode_has_perm(cred, inode, av, &ad, 0);
  1571 + return inode_has_perm(cred, inode, av, &ad);
1573 1572 }
1574 1573  
1575 1574 /* Same as path_has_perm, but uses the inode from the file struct. */
... ... @@ -1581,7 +1580,7 @@
1581 1580  
1582 1581 ad.type = LSM_AUDIT_DATA_PATH;
1583 1582 ad.u.path = file->f_path;
1584   - return inode_has_perm(cred, file_inode(file), av, &ad, 0);
  1583 + return inode_has_perm(cred, file_inode(file), av, &ad);
1585 1584 }
1586 1585  
1587 1586 /* Check whether a task can use an open file descriptor to
... ... @@ -1617,7 +1616,7 @@
1617 1616 /* av is zero if only checking access to the descriptor. */
1618 1617 rc = 0;
1619 1618 if (av)
1620   - rc = inode_has_perm(cred, inode, av, &ad, 0);
  1619 + rc = inode_has_perm(cred, inode, av, &ad);
1621 1620  
1622 1621 out:
1623 1622 return rc;