aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/gspca/nw80x.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-08-16 03:38:13 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-08-19 12:10:47 -0300
commit4843a543fad3bf8221cf14e5d5f32d15cee89e84 (patch)
tree6cf1752bc25bdc6be67c72a251c0ec446f315093 /drivers/media/usb/gspca/nw80x.c
parentmedia: rockchip/rga: Update maintainership (diff)
downloadlinux-dev-4843a543fad3bf8221cf14e5d5f32d15cee89e84.tar.xz
linux-dev-4843a543fad3bf8221cf14e5d5f32d15cee89e84.zip
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>
Diffstat (limited to 'drivers/media/usb/gspca/nw80x.c')
-rw-r--r--drivers/media/usb/gspca/nw80x.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/usb/gspca/nw80x.c b/drivers/media/usb/gspca/nw80x.c
index 59649704beba..880f569bda30 100644
--- a/drivers/media/usb/gspca/nw80x.c
+++ b/drivers/media/usb/gspca/nw80x.c
@@ -1572,6 +1572,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
if (ret < 0) {
pr_err("reg_r err %d\n", ret);
gspca_dev->usb_err = ret;
+ /*
+ * Make sure the buffer is zeroed to avoid uninitialized
+ * values.
+ */
+ memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
return;
}
if (len == 1)