diff options
author | Paul Moore <pmoore@redhat.com> | 2013-07-23 17:38:40 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-07-25 13:02:13 -0400 |
commit | bed4d7efb31fd81b3a3c83dc8540197cd0fe81c0 (patch) | |
tree | 186fe2daebcea0115afe0b45f540a346c2c700a8 /security/selinux | |
parent | d1b17b09f390369271ecfbc7e4a4d0d0dcff1b1b (diff) |
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')
-rw-r--r-- | security/selinux/hooks.c | 8 | ||||
-rw-r--r-- | security/selinux/include/xfrm.h | 5 |
2 files changed, 8 insertions, 5 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) | |||
3722 | u32 nlbl_sid; | 3722 | u32 nlbl_sid; |
3723 | u32 nlbl_type; | 3723 | u32 nlbl_type; |
3724 | 3724 | ||
3725 | selinux_skb_xfrm_sid(skb, &xfrm_sid); | 3725 | err = selinux_skb_xfrm_sid(skb, &xfrm_sid); |
3726 | selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid); | 3726 | if (unlikely(err)) |
3727 | return -EACCES; | ||
3728 | err = selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid); | ||
3729 | if (unlikely(err)) | ||
3730 | return -EACCES; | ||
3727 | 3731 | ||
3728 | err = security_net_peersid_resolve(nlbl_sid, nlbl_type, xfrm_sid, sid); | 3732 | err = security_net_peersid_resolve(nlbl_sid, nlbl_type, xfrm_sid, sid); |
3729 | if (unlikely(err)) { | 3733 | if (unlikely(err)) { |
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h index 60774bcf61b3..7605251936f5 100644 --- a/security/selinux/include/xfrm.h +++ b/security/selinux/include/xfrm.h | |||
@@ -76,10 +76,9 @@ static inline void selinux_xfrm_notify_policyload(void) | |||
76 | } | 76 | } |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | static inline void selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid) | 79 | static inline int selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid) |
80 | { | 80 | { |
81 | int err = selinux_xfrm_decode_session(skb, sid, 0); | 81 | return selinux_xfrm_decode_session(skb, sid, 0); |
82 | BUG_ON(err); | ||
83 | } | 82 | } |
84 | 83 | ||
85 | #endif /* _SELINUX_XFRM_H_ */ | 84 | #endif /* _SELINUX_XFRM_H_ */ |