mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
selinux: don't log MAC_POLICY_LOAD record on failed policy load
commit519dad3bcdupstream. If sel_make_policy_nodes() fails, we should jump to 'out', not 'out1', as the latter would incorrectly log an MAC_POLICY_LOAD audit record, even though the policy hasn't actually been reloaded. The 'out1' jump label now becomes unused and can be removed. Fixes:02a52c5c8c("selinux: move policy commit after updating selinuxfs") Cc: stable@vger.kernel.org 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3b87d0c583
commit
9731e08a33
@@ -651,14 +651,13 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
|
|||||||
length = sel_make_policy_nodes(fsi, newpolicy);
|
length = sel_make_policy_nodes(fsi, newpolicy);
|
||||||
if (length) {
|
if (length) {
|
||||||
selinux_policy_cancel(fsi->state, newpolicy);
|
selinux_policy_cancel(fsi->state, newpolicy);
|
||||||
goto out1;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
selinux_policy_commit(fsi->state, newpolicy);
|
selinux_policy_commit(fsi->state, newpolicy);
|
||||||
|
|
||||||
length = count;
|
length = count;
|
||||||
|
|
||||||
out1:
|
|
||||||
audit_log(audit_context(), GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
|
audit_log(audit_context(), GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
|
||||||
"auid=%u ses=%u lsm=selinux res=1",
|
"auid=%u ses=%u lsm=selinux res=1",
|
||||||
from_kuid(&init_user_ns, audit_get_loginuid(current)),
|
from_kuid(&init_user_ns, audit_get_loginuid(current)),
|
||||||
|
|||||||
Reference in New Issue
Block a user