summaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorPaul Moore2013-07-23 23:38:40 +0200
committerEric Paris2013-07-25 19:02:13 +0200
commitbed4d7efb31fd81b3a3c83dc8540197cd0fe81c0 (patch)
tree186fe2daebcea0115afe0b45f540a346c2c700a8 /security/selinux/hooks.c
parentselinux: cleanup the XFRM header (diff)
downloadkernel-qcow2-linux-bed4d7efb31fd81b3a3c83dc8540197cd0fe81c0.tar.gz
kernel-qcow2-linux-bed4d7efb31fd81b3a3c83dc8540197cd0fe81c0.tar.xz
kernel-qcow2-linux-bed4d7efb31fd81b3a3c83dc8540197cd0fe81c0.zip
selinux: remove the BUG_ON() from selinux_skb_xfrm_sid()
Remove the BUG_ON() from selinux_skb_xfrm_sid() and propogate the error code up to the caller. Also check the return values in the only caller function, selinux_skb_peerlbl_sid(). Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d3555bdf66af..4bc068b3773d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3722,8 +3722,12 @@ static int selinux_skb_peerlbl_sid(struct sk_buff *skb, u16 family, u32 *sid)
u32 nlbl_sid;
u32 nlbl_type;
- selinux_skb_xfrm_sid(skb, &xfrm_sid);
- selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid);
+ err = selinux_skb_xfrm_sid(skb, &xfrm_sid);
+ if (unlikely(err))
+ return -EACCES;
+ err = selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid);
+ if (unlikely(err))
+ return -EACCES;
err = security_net_peersid_resolve(nlbl_sid, nlbl_type, xfrm_sid, sid);
if (unlikely(err)) {