Commit 6600e9f6 authored by John Johansen's avatar John Johansen

apparmor: add missing failure check in compute_xmatch_perms

Add check for failure to allocate the permission table.

Fixes: caa9f579 ("apparmor: isolate policy backwards compatibility to its own file")
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent 000518bc
...@@ -180,6 +180,8 @@ static struct aa_perms *compute_xmatch_perms(struct aa_dfa *xmatch) ...@@ -180,6 +180,8 @@ static struct aa_perms *compute_xmatch_perms(struct aa_dfa *xmatch)
state_count = xmatch->tables[YYTD_ID_BASE]->td_lolen; state_count = xmatch->tables[YYTD_ID_BASE]->td_lolen;
/* DFAs are restricted from having a state_count of less than 2 */ /* DFAs are restricted from having a state_count of less than 2 */
perms = kvcalloc(state_count, sizeof(struct aa_perms), GFP_KERNEL); perms = kvcalloc(state_count, sizeof(struct aa_perms), GFP_KERNEL);
if (!perms)
return NULL;
/* zero init so skip the trap state (state == 0) */ /* zero init so skip the trap state (state == 0) */
for (state = 1; state < state_count; state++) for (state = 1; state < state_count; state++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment