summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLeo Stone <leocstone@gmail.com>2024-12-16 05:27:51 +0100
committerAndrew Morton <akpm@linux-foundation.org>2024-12-19 04:04:47 +0100
commitd3ac65d274b3a93cf9cf9559fd1473ab65e00e10 (patch)
treec609dee723b1f15ae1642e9781ce4f828ae6184b /mm
parentalloc_tag: fix set_codetag_empty() when !CONFIG_MEM_ALLOC_PROFILING_DEBUG (diff)
downloadlinux-d3ac65d274b3a93cf9cf9559fd1473ab65e00e10.tar.xz
linux-d3ac65d274b3a93cf9cf9559fd1473ab65e00e10.zip
mm: huge_memory: handle strsep not finding delimiter
split_huge_pages_write() does not handle the case where strsep finds no delimiter in the given string and sets the input buffer to NULL, which allows this reproducer to trigger a protection fault. Link: https://lkml.kernel.org/r/20241216042752.257090-2-leocstone@gmail.com Signed-off-by: Leo Stone <leocstone@gmail.com> Reported-by: syzbot+8a3da2f1bbf59227c289@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=8a3da2f1bbf59227c289 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/huge_memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index df0c4988dd88..e53d83b3e5cf 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -4169,7 +4169,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf,
size_t input_len = strlen(input_buf);
tok = strsep(&buf, ",");
- if (tok) {
+ if (tok && buf) {
strscpy(file_path, tok);
} else {
ret = -EINVAL;