ima: Have the LSM free its audit rule
authorTyler Hicks <tyhicks@linux.microsoft.com>
Thu, 9 Jul 2020 06:19:00 +0000 (01:19 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:54 +0000 (08:23 +0200)
commit70a752610d14addbbe6fac5e9459261f4a4cfaa2
treec1e71e4ab051d3e46abdfa1370218e6bf1330ee4
parent6e1ab3bf6ad3e4b88f6ca91ff1d137b98f3dddb8
ima: Have the LSM free its audit rule

[ Upstream commit 9ff8a616dfab96a4fa0ddd36190907dc68886d9b ]

Ask the LSM to free its audit rule rather than directly calling kfree().
Both AppArmor and SELinux do additional work in their audit_rule_free()
hooks. Fix memory leaks by allowing the LSMs to perform necessary work.

Fixes: b16942455193 ("ima: use the lsm policy update notifier")
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Cc: Janne Karhunen <janne.karhunen@gmail.com>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/integrity/ima/ima.h
security/integrity/ima/ima_policy.c