]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: Fix use-after-free in aa_audit_rule_init
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Mon, 21 Oct 2019 15:23:47 +0000 (10:23 -0500)
committerJohn Johansen <john.johansen@canonical.com>
Thu, 21 May 2020 22:25:51 +0000 (15:25 -0700)
commitd5453a63191b608166107fdf4a9d70d4c8d5e950
treed43fe9636bb5c992caead0e29a7aba02c2b3dbec
parent27de3bbcc516d84bbac29b97299d8ae8ca6f9bf4
apparmor: Fix use-after-free in aa_audit_rule_init

In the implementation of aa_audit_rule_init(), when aa_label_parse()
fails the allocated memory for rule is released using
aa_audit_rule_free(). But after this release, the return statement
tries to access the label field of the rule which results in
use-after-free. Before releasing the rule, copy errNo and return it
after release.

Fixes: 85685731e164 ("apparmor: Fix memory leak of rule on error exit path")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/audit.c