summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lee <ryan.lee@canonical.com>2026-01-07 22:48:54 +0300
committerJohn Johansen <john.johansen@canonical.com>2026-01-29 12:27:53 +0300
commit48d5268e911abcf7674ec33c9b0b3e952be1175e (patch)
treed9a8fbd1d9e25408e94ed24563b262f0258258ad
parent8d34e16f7f2b51f880957f2caadaae731ee28867 (diff)
downloadlinux-48d5268e911abcf7674ec33c9b0b3e952be1175e.tar.xz
apparmor: fix boolean argument in apparmor_mmap_file
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>
-rw-r--r--security/apparmor/lsm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index a87cd60ed206..acca3d6efdbc 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -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,