SELinux: Bug fix in polidydb_destroy
commit6e8c751e07b34d73069e9333f67fbe5ffe31ec3a
authorChad Sellers <csellers@tresys.com>
Fri, 6 Oct 2006 20:09:52 +0000 (6 16:09 -0400)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 12 Oct 2006 06:59:41 +0000 (11 23:59 -0700)
tree6fe661be57040eebd237c5bed86e5eb76910639e
parent3bccfbc7a7ba4085817deae6e7c67daf0cbd045a
SELinux: Bug fix in polidydb_destroy

This patch fixes two bugs in policydb_destroy. Two list pointers
(policydb.ocontexts[i] and policydb.genfs) were not being reset to NULL when
the lists they pointed to were being freed. This caused a problem when the
initial policy load failed, as the policydb being destroyed was not a
temporary new policydb that was thrown away, but rather was the global
(active) policydb. Consequently, later functions, particularly
sys_bind->selinux_socket_bind->security_node_sid and
do_rw_proc->selinux_sysctl->selinux_proc_get_sid->security_genfs_sid tried
to dereference memory that had previously been freed.

Signed-off-by: Chad Sellers <csellers@tresys.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/selinux/ss/policydb.c