Skip to content

Commit 9c95a27

Browse files
pks-tjrjohansen
authored andcommitted
apparmor: fix bind mounts aborting with -ENOMEM
With commit df32333 ("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: df32333 ("apparmor: Use a memory pool instead per-CPU caches") Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent fd69884 commit 9c95a27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/apparmor/mount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ int aa_bind_mount(struct aa_label *label, const struct path *path,
442442
buffer = aa_get_buffer(false);
443443
old_buffer = aa_get_buffer(false);
444444
error = -ENOMEM;
445-
if (!buffer || old_buffer)
445+
if (!buffer || !old_buffer)
446446
goto out;
447447

448448
error = fn_for_each_confined(label, profile,

0 commit comments

Comments
 (0)