]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
selinux: fix memory leak in policydb_init()
authorOndrej Mosnacek <omosnace@redhat.com>
Thu, 25 Jul 2019 10:52:43 +0000 (12:52 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitbaad4cd55cf9ead94723091945145a2f81cde907
treec2507e324cd512dbf2b679b2c158f505189608cc
parentce0cb5cbf1ba48b6258b3afc160bb285b7258650
selinux: fix memory leak in policydb_init()

BugLink: https://bugs.launchpad.net/bugs/1839376
commit 45385237f65aeee73641f1ef737d7273905a233f upstream.

Since roles_init() adds some entries to the role hash table, we need to
destroy also its keys/values on error, otherwise we get a memory leak in
the error path.

Cc: <stable@vger.kernel.org>
Reported-by: syzbot+fee3a14d4cdf92646287@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/selinux/ss/policydb.c