From: Edward Adam Davis Date: Sun, 8 Sep 2024 09:17:41 +0000 (+0800) Subject: USB: usbtmc: prevent kernel-usb-infoleak X-Git-Tag: v5.10.227~462 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16e0ab9ed3ae7d19ca8ee718ba4e09d5c0f909ca;p=thirdparty%2Fkernel%2Fstable.git USB: usbtmc: prevent kernel-usb-infoleak commit 625fa77151f00c1bd00d34d60d6f2e710b3f9aad upstream. The syzbot reported a kernel-usb-infoleak in usbtmc_write, we need to clear the structure before filling fields. Fixes: 4ddc645f40e9 ("usb: usbtmc: Add ioctl for vendor specific write") Reported-and-tested-by: syzbot+9d34f80f841e948c3fdb@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=9d34f80f841e948c3fdb Signed-off-by: Edward Adam Davis Cc: stable Link: https://lore.kernel.org/r/tencent_9649AA6EC56EDECCA8A7D106C792D1C66B06@qq.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 76ff182427bc6..78adc112a77bb 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -724,7 +724,7 @@ static struct urb *usbtmc_create_urb(void) if (!urb) return NULL; - dmabuf = kmalloc(bufsize, GFP_KERNEL); + dmabuf = kzalloc(bufsize, GFP_KERNEL); if (!dmabuf) { usb_free_urb(urb); return NULL;