selinux: ensure we cleanup the internal AVC counters on error in avc_insert()
authorPaul Moore <paul@paul-moore.com>
Tue, 10 Dec 2019 01:39:46 +0000 (20:39 -0500)
committerPaul Moore <paul@paul-moore.com>
Tue, 10 Dec 2019 19:16:53 +0000 (14:16 -0500)
commitd8db60cb23e49a92cf8cada3297395c7fa50fdf8
treec35db44612802989e1e84f6ff69c414d6bc858e1
parentb2104ac0bd951a2887a03b09e2106fcff5fad94e
selinux: ensure we cleanup the internal AVC counters on error in avc_insert()

Fix avc_insert() to call avc_node_kill() if we've already allocated
an AVC node and the code fails to insert the node in the cache.

Fixes: fa1aa143ac4a ("selinux: extended permissions for ioctls")
Reported-by: rsiddoji@codeaurora.org
Suggested-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/avc.c