Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: MT - limit max slots

syzbot is reporting too large allocation at input_mt_init_slots(), for
num_slots is supplied from userspace using ioctl(UI_DEV_CREATE).

Since nobody knows possible max slots, this patch chose 1024.

Reported-by: syzbot <syzbot+0122fa359a69694395d5@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=0122fa359a69694395d5
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Tetsuo Handa and committed by
Linus Torvalds
99d3bf5f 3894840a

+3
+3
drivers/input/input-mt.c
··· 46 46 return 0; 47 47 if (mt) 48 48 return mt->num_slots != num_slots ? -EINVAL : 0; 49 + /* Arbitrary limit for avoiding too large memory allocation. */ 50 + if (num_slots > 1024) 51 + return -EINVAL; 49 52 50 53 mt = kzalloc(struct_size(mt, slots, num_slots), GFP_KERNEL); 51 54 if (!mt)