qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] usb: initialize libusb_device to avoid crash


From: Gonglei (Arei)
Subject: Re: [Qemu-devel] [PATCH] usb: initialize libusb_device to avoid crash
Date: Fri, 20 Jun 2014 07:49:01 +0000







> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Jincheng Miao
> Sent: Friday, June 20, 2014 2:13 PM
> To: address@hidden
> Cc: address@hidden; Jincheng Miao
> Subject: [Qemu-devel] [PATCH] usb: initialize libusb_device to avoid crash
> 
> If libusb_get_device_list() fails, the uninitialized local variable
> libusb_device would be passed to libusb_free_device_list(), that
> will cause a crash, like:
> (gdb) bt
>  #0  0x00007fbbb4bafc10 in pthread_mutex_lock () from
> /lib64/libpthread.so.0
>  #1  0x00007fbbb233e653 in libusb_unref_device (dev=0x6275682d627375)
>      at core.c:902
>  #2  0x00007fbbb233e739 in libusb_free_device_list (list=0x7fbbb6e8436e,
>      unref_devices=<optimized out>) at core.c:653
>  #3  0x00007fbbb6cd80a4 in usb_host_auto_check
> (address@hidden)
>      at hw/usb/host-libusb.c:1446
>  #4  0x00007fbbb6cd8525 in usb_host_initfn (udev=0x7fbbbd3c5670)
>      at hw/usb/host-libusb.c:912
>  #5  0x00007fbbb6cc123b in usb_device_init (dev=0x7fbbbd3c5670)
>      at hw/usb/bus.c:106
>  ...
> 
> So initialize libusb_device at the begin time.
> 
> Signed-off-by: Jincheng Miao <address@hidden>
> ---
>  hw/usb/host-libusb.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Gonglei <address@hidden>

Best regards,
-Gonglei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]