summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorMicah Morton <mortonm@chromium.org>2019-09-17 11:27:05 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-29 09:22:02 +0100
commit8cd0912adf398c7b2ee1a154368f56a43de12494 (patch)
tree4f08afad8e06fde5bb96075668bbc5e2c60f3e30 /security
parent7a5c15a0a905897636933357cb5752af9b13a5a5 (diff)
downloadlinux-8cd0912adf398c7b2ee1a154368f56a43de12494.tar.gz
linux-8cd0912adf398c7b2ee1a154368f56a43de12494.tar.bz2
linux-8cd0912adf398c7b2ee1a154368f56a43de12494.zip
LSM: SafeSetID: Stop releasing uninitialized ruleset
[ Upstream commit 21ab8580b383f27b7f59b84ac1699cb26d6c3d69 ] The first time a rule set is configured for SafeSetID, we shouldn't be trying to release the previously configured ruleset, since there isn't one. Currently, the pointer that would point to a previously configured ruleset is uninitialized on first rule set configuration, leading to a crash when we try to call release_ruleset with that pointer. Acked-by: Jann Horn <jannh@google.com> Signed-off-by: Micah Morton <mortonm@chromium.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r--security/safesetid/securityfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/safesetid/securityfs.c b/security/safesetid/securityfs.c
index d568e17dd773..74a13d432ed8 100644
--- a/security/safesetid/securityfs.c
+++ b/security/safesetid/securityfs.c
@@ -187,7 +187,8 @@ out_free_rule:
out_free_buf:
kfree(buf);
out_free_pol:
- release_ruleset(pol);
+ if (pol)
+ release_ruleset(pol);
return err;
}