From: Paul Moore <pmoore@redhat.com>
To: linux-security-module@vger.kernel.org, eparis@redhat.com,
selinux@tycho.nsa.gov
Subject: [PATCH 9/9] selinux: remove the BUG_ON() from selinux_skb_xfrm_sid()
Date: Tue, 25 Jun 2013 17:19:14 -0400 [thread overview]
Message-ID: <20130625211914.5057.14361.stgit@localhost> (raw)
In-Reply-To: <20130625211306.5057.31329.stgit@localhost>
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>
---
security/selinux/hooks.c | 8 ++++++--
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 d3555bd..4bc068b 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)) {
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h
index 60774bc..7605251 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)
}
#endif
-static inline void selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid)
+static inline int selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid)
{
- int err = selinux_xfrm_decode_session(skb, sid, 0);
- BUG_ON(err);
+ return selinux_xfrm_decode_session(skb, sid, 0);
}
#endif /* _SELINUX_XFRM_H_ */
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2013-06-25 21:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 21:18 [PATCH 0/9] Labeled networking patches for 3.11 Paul Moore
2013-06-25 21:18 ` [PATCH 1/9] selinux: fix problems in netnode when BUG() is compiled out Paul Moore
2013-06-25 21:18 ` [PATCH 2/9] lsm: split the xfrm_state_alloc_security() hook implementation Paul Moore
2013-06-25 21:18 ` [PATCH 3/9] selinux: cleanup and consolidate the XFRM alloc/clone/delete/free code Paul Moore
2013-06-25 21:18 ` [PATCH 4/9] selinux: cleanup selinux_xfrm_policy_lookup() and selinux_xfrm_state_pol_flow_match() Paul Moore
2013-06-25 21:18 ` [PATCH 5/9] selinux: cleanup selinux_xfrm_sock_rcv_skb() and selinux_xfrm_postroute_last() Paul Moore
2013-06-25 21:18 ` [PATCH 6/9] selinux: cleanup some comment and whitespace issues in the XFRM code Paul Moore
2013-06-25 21:19 ` [PATCH 7/9] selinux: cleanup selinux_xfrm_decode_session() Paul Moore
2013-06-25 21:19 ` [PATCH 8/9] selinux: cleanup the XFRM header Paul Moore
2013-06-25 21:19 ` Paul Moore [this message]
2013-06-25 23:53 ` [PATCH 0/9] Labeled networking patches for 3.11 Casey Schaufler
2013-06-26 13:52 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130625211914.5057.14361.stgit@localhost \
--to=pmoore@redhat.com \
--cc=eparis@redhat.com \
--cc=linux-security-module@vger.kernel.org \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.