]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
usb: check USB configuration descriptor object
authorPrasad J Pandit <pjp@fedoraproject.org>
Thu, 11 Feb 2016 11:01:20 +0000 (16:31 +0530)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 22 Mar 2016 22:40:56 +0000 (17:40 -0500)
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 <luodalongde@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 1455188480-14688-1-git-send-email-ppandit@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 80eecda8e5d09c442c24307f340840a5b70ea3b9)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/usb/dev-network.c

index ba3c7a718adcec5e2d68c54565ee98024a7612b8..180adce6188ed4ce613d22dd790ac00284366f60 100644 (file)
@@ -653,7 +653,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,