diff options
author | Prasad J Pandit <pjp@fedoraproject.org> | 2016-02-11 16:31:20 +0530 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2016-03-22 17:40:56 -0500 |
commit | 80b6e5723fac428ea6c08c821078286f43975df8 (patch) | |
tree | 94e330e2f33abacafae968c0dde5dadca53c7a73 | |
parent | 9bddb45dbc010cd8ee4d48bd501fa5d18dcec00c (diff) | |
download | qemu-80b6e5723fac428ea6c08c821078286f43975df8.zip qemu-80b6e5723fac428ea6c08c821078286f43975df8.tar.gz qemu-80b6e5723fac428ea6c08c821078286f43975df8.tar.bz2 |
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 <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>
-rw-r--r-- | hw/usb/dev-network.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index ba3c7a7..180adce 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -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, |