mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 08:45:51 +00:00
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>
This commit is contained in:
parent
60da7445a1
commit
d3ac65d274
@ -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);
|
size_t input_len = strlen(input_buf);
|
||||||
|
|
||||||
tok = strsep(&buf, ",");
|
tok = strsep(&buf, ",");
|
||||||
if (tok) {
|
if (tok && buf) {
|
||||||
strscpy(file_path, tok);
|
strscpy(file_path, tok);
|
||||||
} else {
|
} else {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user