| From 8a9a248e1ec4fadbf4df76063e49a01f781c7b36 Mon Sep 17 00:00:00 2001 |
| From: Hans Verkuil <hverkuil-cisco@xs4all.nl> |
| Date: Tue, 12 Nov 2019 10:22:24 +0100 |
| Subject: [PATCH] media: gspca: zero usb_buf |
| |
| commit de89d0864f66c2a1b75becfdd6bf3793c07ce870 upstream. |
| |
| Allocate gspca_dev->usb_buf with kzalloc instead of kmalloc to |
| ensure it is property zeroed. This fixes various syzbot errors |
| about uninitialized data. |
| |
| Syzbot links: |
| |
| https://syzkaller.appspot.com/bug?extid=32310fc2aea76898d074 |
| https://syzkaller.appspot.com/bug?extid=99706d6390be1ac542a2 |
| https://syzkaller.appspot.com/bug?extid=64437af5c781a7f0e08e |
| |
| Reported-and-tested-by: syzbot+32310fc2aea76898d074@syzkaller.appspotmail.com |
| Reported-and-tested-by: syzbot+99706d6390be1ac542a2@syzkaller.appspotmail.com |
| Reported-and-tested-by: syzbot+64437af5c781a7f0e08e@syzkaller.appspotmail.com |
| |
| Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> |
| Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c |
| index a7ed5257cdba..9d14a58a4fad 100644 |
| --- a/drivers/media/usb/gspca/gspca.c |
| +++ b/drivers/media/usb/gspca/gspca.c |
| @@ -1472,7 +1472,7 @@ int gspca_dev_probe2(struct usb_interface *intf, |
| pr_err("couldn't kzalloc gspca struct\n"); |
| return -ENOMEM; |
| } |
| - gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL); |
| + gspca_dev->usb_buf = kzalloc(USB_BUF_SZ, GFP_KERNEL); |
| if (!gspca_dev->usb_buf) { |
| pr_err("out of memory\n"); |
| ret = -ENOMEM; |
| -- |
| 2.7.4 |
| |