]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
apparmor: aa_getprocattr free procattr leak on format failure
authorZygmunt Krynicki <me@zygoon.pl>
Sat, 2 May 2026 11:37:14 +0000 (13:37 +0200)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 14 Jun 2026 03:18:30 +0000 (20:18 -0700)
commitfea23bf73f0cae8ccb1d0684e4a3003874771f41
treedce15b41cdb45e16f82cb628b18d6dfb0aede64d
parente27bfb2ae9ad8522aea82d435fd6d73cccee7e17
apparmor: aa_getprocattr free procattr leak on format failure

aa_getprocattr() allocates the output string before rendering the label
into it. If the second aa_label_snxprint() call fails, the function
returned without freeing that allocation.

Free and clear the output pointer on the uncommon formatting failure path
before dropping the namespace reference.

Fixes: 76a1d263aba3 ("apparmor: switch getprocattr to using label_print fns()")
Reviewed-by: Tyler Hicks <code@thicks.com>
Reviewed-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/procattr.c