Skip to contentSkip to conversation

LSM: SafeSetID: Stop releasing uninitialized ruleset

PATCH New [email protected] 1 participant 1 message Sep 16, 2019

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 LSM: SafeSetID: Stop releasing uninitialized ruleset

From: Micah Morton <[email protected]>

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.

---
 security/safesetid/securityfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/safesetid/securityfs.c +2 -1
index d568e17dd773..74a13d432ed8 100644
@@ -187,7 +187,8 @@ static ssize_t handle_policy_update(struct file *file,
 out_free_buf:
 	kfree(buf);
 out_free_pol:
-	release_ruleset(pol);
+	if (pol)
+                release_ruleset(pol);
 	return err;
 }
 
Signature · 1 line
2.23.0.237.gc6a4ce50a0-goog