From: Prasad J Pandit Date: Thu, 11 Feb 2016 11:01:20 +0000 (+0530) Subject: usb: check USB configuration descriptor object X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=80eecda8e5d09c442c24307f340840a5b70ea3b9;p=qemu.git usb: check USB configuration descriptor object When processing remote NDIS control message packets, the USB Net device emulator checks to see if the USB configuration descriptor object is of RNDIS type(2). But it does not check if it is null, which leads to a null dereference error. Add check to avoid it. Reported-by: Qinghao Tang Signed-off-by: Prasad J Pandit Message-id: 1455188480-14688-1-git-send-email-ppandit@redhat.com Signed-off-by: Gerd Hoffmann --- diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 985a6298bf..5dc45383d3 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -654,7 +654,8 @@ typedef struct USBNetState { static int is_rndis(USBNetState *s) { - return s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE; + return s->dev.config ? + s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE : 0; } static int ndis_query(USBNetState *s, uint32_t oid,