]> 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)
commit1b41474472f8045bdb65cb4fcb552dbdffda1c2c
treed43fe9636bb5c992caead0e29a7aba02c2b3dbec
parent447a64a6b77ed36a11e270f5d1c2bd0d249dcb0c
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: e7de3b57db1b ("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