Skip to content

Commit 21ab858

Browse files
committed
LSM: SafeSetID: Stop releasing uninitialized ruleset
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 <[email protected]> Signed-off-by: Micah Morton <[email protected]>
1 parent 609488b commit 21ab858

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/safesetid/securityfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ static ssize_t handle_policy_update(struct file *file,
187187
out_free_buf:
188188
kfree(buf);
189189
out_free_pol:
190-
release_ruleset(pol);
190+
if (pol)
191+
release_ruleset(pol);
191192
return err;
192193
}
193194

0 commit comments

Comments
 (0)