Skip to content

Commit cc21928

Browse files
zygagregkh
authored andcommitted
apparmor: aa_label_alloc use aa_label_free on alloc failure
[ Upstream commit 654fe75 ] aa_label_alloc() allocates a secid before allocating or taking the label proxy. If the later proxy step fails, the error path only freed the label memory, leaking any resources initialized by aa_label_init(). Use aa_label_free() on the failure path so partially initialized labels release their secid and other label resources before the backing memory is freed. Fixes: f1bd904 ("apparmor: add the base fns() for domain labels") Signed-off-by: Zygmunt Krynicki <me@zygoon.pl> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b7c45c0 commit cc21928

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

security/apparmor/label.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ struct aa_label *aa_label_alloc(int size, struct aa_proxy *proxy, gfp_t gfp)
452452
return new;
453453

454454
fail:
455-
kfree(new);
455+
aa_label_free(new);
456456

457457
return NULL;
458458
}

0 commit comments

Comments
 (0)