]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix bind mounts aborting with -ENOMEM
authorPatrick Steinhardt <ps@pks.im>
Wed, 11 Dec 2019 11:44:08 +0000 (12:44 +0100)
committerJohn Johansen <john.johansen@canonical.com>
Thu, 2 Jan 2020 13:31:40 +0000 (05:31 -0800)
commit29c538f4f1fd68045ab6a7bf35dab7532af68762
tree4984741bc9bcbe491ce6ec6237e90a435b551a01
parenta703976d8e9b2972343d7af9d551c41c680d9d84
apparmor: fix bind mounts aborting with -ENOMEM

With commit 390b87ae0f0d ("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: 390b87ae0f0d ("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>
security/apparmor/mount.c