]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
apparmor: fix boolean argument in apparmor_mmap_file
authorRyan Lee <ryan.lee@canonical.com>
Wed, 7 Jan 2026 19:48:54 +0000 (11:48 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Thu, 29 Jan 2026 09:27:53 +0000 (01:27 -0800)
The previous value of GFP_ATOMIC is an int and not a bool, potentially
resulting in UB when being assigned to a bool. In addition, the mmap hook
is called outside of locks (i.e. in a non-atomic context), so we can pass
a fixed constant value of false instead to common_mmap.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/lsm.c

index a87cd60ed2069905922a93b4100858ae2afa46a7..acca3d6efdbc84003ef19906caa2f25503969c50 100644 (file)
@@ -584,7 +584,7 @@ static int common_mmap(const char *op, struct file *file, unsigned long prot,
 static int apparmor_mmap_file(struct file *file, unsigned long reqprot,
                              unsigned long prot, unsigned long flags)
 {
-       return common_mmap(OP_FMMAP, file, prot, flags, GFP_ATOMIC);
+       return common_mmap(OP_FMMAP, file, prot, flags, false);
 }
 
 static int apparmor_file_mprotect(struct vm_area_struct *vma,