Skip to content

Commit 519dad3

Browse files
WOnder93pcmoore
authored andcommitted
selinux: don't log MAC_POLICY_LOAD record on failed policy load
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: 02a52c5 ("selinux: move policy commit after updating selinuxfs") Cc: [email protected] Signed-off-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 365982a commit 519dad3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

security/selinux/selinuxfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,13 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
651651
length = sel_make_policy_nodes(fsi, newpolicy);
652652
if (length) {
653653
selinux_policy_cancel(fsi->state, newpolicy);
654-
goto out1;
654+
goto out;
655655
}
656656

657657
selinux_policy_commit(fsi->state, newpolicy);
658658

659659
length = count;
660660

661-
out1:
662661
audit_log(audit_context(), GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
663662
"auid=%u ses=%u lsm=selinux res=1",
664663
from_kuid(&init_user_ns, audit_get_loginuid(current)),

0 commit comments

Comments
 (0)