Skip to content

Commit e5fa841

Browse files
committed
Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull memcg-v1 fix from Al Viro: "memcg_write_event_control() oops fix" * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: memcg_write_event_control(): fix a user-triggerable oops
2 parents c2cdb13 + 046667c commit e5fa841

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mm/memcontrol-v1.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,9 +1842,12 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
18421842
buf = endp + 1;
18431843

18441844
cfd = simple_strtoul(buf, &endp, 10);
1845-
if ((*endp != ' ') && (*endp != '\0'))
1845+
if (*endp == '\0')
1846+
buf = endp;
1847+
else if (*endp == ' ')
1848+
buf = endp + 1;
1849+
else
18461850
return -EINVAL;
1847-
buf = endp + 1;
18481851

18491852
event = kzalloc(sizeof(*event), GFP_KERNEL);
18501853
if (!event)

0 commit comments

Comments
 (0)