diff options
author | Paul Moore <paul@paul-moore.com> | 2016-03-28 15:19:10 -0400 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2016-04-05 16:10:52 -0400 |
commit | 899134f2f6e27dcae1fee12593c492577cc80987 (patch) | |
tree | e9581c725a218d2aec26b2a5f5a7c3850c2e94f0 /security | |
parent | 341e0cb593a2b7ec86dd6ca96c68eadc3f6fe1e6 (diff) |
selinux: don't revalidate inodes in selinux_socket_getpeersec_dgram()
We don't have to worry about socket inodes being invalidated so
use inode_security_novalidate() to fetch the inode's security blob.
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/hooks.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 912deee3f01e..65642be91644 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -4598,6 +4598,7 @@ static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff * | |||
4598 | { | 4598 | { |
4599 | u32 peer_secid = SECSID_NULL; | 4599 | u32 peer_secid = SECSID_NULL; |
4600 | u16 family; | 4600 | u16 family; |
4601 | struct inode_security_struct *isec; | ||
4601 | 4602 | ||
4602 | if (skb && skb->protocol == htons(ETH_P_IP)) | 4603 | if (skb && skb->protocol == htons(ETH_P_IP)) |
4603 | family = PF_INET; | 4604 | family = PF_INET; |
@@ -4608,9 +4609,10 @@ static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff * | |||
4608 | else | 4609 | else |
4609 | goto out; | 4610 | goto out; |
4610 | 4611 | ||
4611 | if (sock && family == PF_UNIX) | 4612 | if (sock && family == PF_UNIX) { |
4612 | selinux_inode_getsecid(SOCK_INODE(sock), &peer_secid); | 4613 | isec = inode_security_novalidate(SOCK_INODE(sock)); |
4613 | else if (skb) | 4614 | peer_secid = isec->sid; |
4615 | } else if (skb) | ||
4614 | selinux_skb_peerlbl_sid(skb, family, &peer_secid); | 4616 | selinux_skb_peerlbl_sid(skb, family, &peer_secid); |
4615 | 4617 | ||
4616 | out: | 4618 | out: |