selinux June 2013 archive
Main Archive Page > Month Archives  > selinux archives
selinux: [PATCH 1/9] selinux: fix problems in netnode when BUG()

[PATCH 1/9] selinux: fix problems in netnode when BUG() is compiled out

From: Paul Moore <pmoore_at_nospam>
Date: Tue Jun 25 2013 - 21:18:18 GMT
To: linux-security-module@vger.kernel.org, eparis@redhat.com, selinux@tycho.nsa.gov

When the BUG() macro is disabled at compile time it can cause some
problems in the SELinux netnode code: invalid return codes and
uninitialized variables. This patch fixes this by making sure we take
some corrective action after the BUG() macro.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Paul Moore <pmoore@redhat.com>

--- In the process of cleaning up a local git tree I realized I had this patch still sitting in my tree that for some reason hadn't been merged upstream. Originally sent back on December 5, 2012. --- security/selinux/netnode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/selinux/netnode.c b/security/selinux/netnode.c index c5454c0..03a72c3 100644 --- a/security/selinux/netnode.c +++ b/security/selinux/netnode.c @@ -166,6 +166,7 @@ static void sel_netnode_insert(struct sel_netnode *node) break; default: BUG(); + return; } /* we need to impose a limit on the growth of the hash table so check @@ -225,6 +226,7 @@ static int sel_netnode_sid_slow(void *addr, u16 family, u32 *sid) break; default: BUG(); + ret = -EINVAL; } if (ret != 0) goto out; -- 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.