]> git.ipfire.org Git - thirdparty/linux.git/commit
apparmor: return -ENOMEM in unpack_perms_table upon alloc failure
authorRyan Lee <ryan.lee@canonical.com>
Tue, 13 Jan 2026 17:35:57 +0000 (09:35 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Thu, 29 Jan 2026 09:27:54 +0000 (01:27 -0800)
commit74b7105e53e80a4072bd3e1a50be7aa15e3f0a01
treef44d9abfc02aa0993e5bef4e87ab51a30002e400
parent9b829c0aa96e9385b1e9a308d3eb054b95fbeda2
apparmor: return -ENOMEM in unpack_perms_table upon alloc failure

In policy_unpack.c:unpack_perms_table, the perms struct is allocated via
kcalloc, with the position being reset if the allocation fails. However,
the error path results in -EPROTO being retured instead of -ENOMEM. Fix
this to return the correct error code.

Reported-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Fixes: fd1b2b95a2117 ("apparmor: add the ability for policy to specify a permission table")
Reviewed-by: Tyler Hicks <code@tyhicks.com>
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/policy_unpack.c