Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

apparmor: fix bind mounts aborting with -ENOMEM

With commit df323337e507 ("apparmor: Use a memory pool instead per-CPU
caches, 2019-05-03"), AppArmor code was converted to use memory pools. In
that conversion, a bug snuck into the code that polices bind mounts that
causes all bind mounts to fail with -ENOMEM, as we erroneously error out
if `aa_get_buffer` returns a pointer instead of erroring out when it
does _not_ return a valid pointer.

Fix the issue by correctly checking for valid pointers returned by
`aa_get_buffer` to fix bind mounts with AppArmor.

Fixes: df323337e507 ("apparmor: Use a memory pool instead per-CPU caches")
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: John Johansen <john.johansen@canonical.com>

authored by

Patrick Steinhardt and committed by
John Johansen
9c95a278 fd698849

+1 -1
+1 -1
security/apparmor/mount.c
··· 442 442 buffer = aa_get_buffer(false); 443 443 old_buffer = aa_get_buffer(false); 444 444 error = -ENOMEM; 445 - if (!buffer || old_buffer) 445 + if (!buffer || !old_buffer) 446 446 goto out; 447 447 448 448 error = fn_for_each_confined(label, profile,