Re: [syzbot] [fs?] KASAN: null-ptr-deref Write in do_pagemap_cmd
From: Edward Adam Davis
Date: Mon Mar 04 2024 - 19:57:00 EST
please test null ptr deref in do_pagemap_cmd
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 3f78ebbb795f..ab28666956d0 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -2510,6 +2510,8 @@ static long do_pagemap_cmd(struct file *file, unsigned int cmd,
switch (cmd) {
case PAGEMAP_SCAN:
+ if (!mm)
+ return -EINVAL;
return do_pagemap_scan(mm, arg);
default: