media: gspca: zero usb_buf on error
commit4843a543fad3bf8221cf14e5d5f32d15cee89e84
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 16 Aug 2019 06:38:13 +0000 (16 03:38 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 19 Aug 2019 15:10:47 +0000 (19 12:10 -0300)
tree6cf1752bc25bdc6be67c72a251c0ec446f315093
parent2509d725e02adcf4d1375f80f2beef925b4a10aa
media: gspca: zero usb_buf on error

If reg_r() fails, then gspca_dev->usb_buf was left uninitialized,
and some drivers used the contents of that buffer in logic.

This caused several syzbot errors:

https://syzkaller.appspot.com/bug?extid=397fd082ce5143e2f67d
https://syzkaller.appspot.com/bug?extid=1a35278dd0ebfb3a038a
https://syzkaller.appspot.com/bug?extid=06ddf1788cfd048c5e82

I analyzed the gspca drivers and zeroed the buffer where needed.

Reported-and-tested-by: syzbot+1a35278dd0ebfb3a038a@syzkaller.appspotmail.com
Reported-and-tested-by: syzbot+397fd082ce5143e2f67d@syzkaller.appspotmail.com
Reported-and-tested-by: syzbot+06ddf1788cfd048c5e82@syzkaller.appspotmail.com
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
14 files changed:
drivers/media/usb/gspca/konica.c
drivers/media/usb/gspca/nw80x.c
drivers/media/usb/gspca/ov519.c
drivers/media/usb/gspca/ov534.c
drivers/media/usb/gspca/ov534_9.c
drivers/media/usb/gspca/se401.c
drivers/media/usb/gspca/sn9c20x.c
drivers/media/usb/gspca/sonixb.c
drivers/media/usb/gspca/sonixj.c
drivers/media/usb/gspca/spca1528.c
drivers/media/usb/gspca/sq930x.c
drivers/media/usb/gspca/sunplus.c
drivers/media/usb/gspca/vc032x.c
drivers/media/usb/gspca/w996Xcf.c