]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
USB: usbtmc: prevent kernel-usb-infoleak
authorEdward Adam Davis <eadavis@qq.com>
Sun, 8 Sep 2024 09:17:41 +0000 (17:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Sep 2024 13:34:17 +0000 (15:34 +0200)
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 <eadavis@qq.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/tencent_9649AA6EC56EDECCA8A7D106C792D1C66B06@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/usbtmc.c

index 6bd9fe565385893318e85f05dc5b4bd52df5ddfa..34e46ef308abfd09663f3121808277614db60505 100644 (file)
@@ -754,7 +754,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;