Skip to content

Commit

Permalink
selinux: fix problems in netnode when BUG() is compiled out
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Eric Paris <eparis@redhat.com>
  • Loading branch information
Paul Moore authored and Eric Paris committed Jul 25, 2013
1 parent b43e725 commit b04eea8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions security/selinux/netnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b04eea8

Please sign in to comment.