Skip to content

Commit d3ac65d

Browse files
leocstoneakpm00
authored andcommitted
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/[email protected] Signed-off-by: Leo Stone <[email protected]> Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=8a3da2f1bbf59227c289 Signed-off-by: Andrew Morton <[email protected]>
1 parent 60da744 commit d3ac65d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/huge_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4169,7 +4169,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf,
41694169
size_t input_len = strlen(input_buf);
41704170

41714171
tok = strsep(&buf, ",");
4172-
if (tok) {
4172+
if (tok && buf) {
41734173
strscpy(file_path, tok);
41744174
} else {
41754175
ret = -EINVAL;

0 commit comments

Comments
 (0)