On Tue, 3 Sep 2019, syzbot wrote:

> Hello,
> 
> syzbot has tested the proposed patch but the reproducer still triggered  
> crash:
> KASAN: slab-out-of-bounds Read in usb_reset_and_verify_device
> 
> usb 4-1: Old BOS 00000000ffd70172  Len 0xa8
> usb 4-1: New BOS 00000000b6d58371  Len 0xa8
> ==================================================================
> BUG: KASAN: slab-out-of-bounds in memcmp+0xa6/0xb0 lib/string.c:904
> Read of size 1 at addr ffff8881cd95d876 by task kworker/0:4/2841

Argh -- I forgot about printk's kernel-address mangling.  Let's try 
again.

Alan Stern

#syz test: https://github.com/google/kasan.git eea39f24

Index: usb-devel/drivers/usb/core/hub.c
===================================================================
--- usb-devel.orig/drivers/usb/core/hub.c
+++ usb-devel/drivers/usb/core/hub.c
@@ -5721,6 +5721,13 @@ static int usb_reset_and_verify_device(s
        if (ret < 0)
                goto re_enumerate;
 
+       if (bos)
+               dev_info(&udev->dev, "Old BOS %px  Len 0x%x\n",
+                       bos, le16_to_cpu(bos->desc->wTotalLength));
+       if (udev->bos)
+               dev_info(&udev->dev, "New BOS %px  Len 0x%x\n",
+                       udev->bos, le16_to_cpu(udev->bos->desc->wTotalLength));
+
        /* Device might have changed firmware (DFU or similar) */
        if (descriptors_changed(udev, &descriptor, bos)) {
                dev_info(&udev->dev, "device firmware changed\n");


Reply via email to