Skip to contentSkip to conversation

usb: check USB configuration descriptor object

PATCH In review P J P 2 participants 2 messages Feb 11, 2016 – Feb 16, 2016

lore
Share & tools
lore

P J P

author
#0 lore raw

PATCH 1/1 usb: check USB configuration descriptor object

From: Prasad J Pandit <[email protected]>

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.

---
 hw/usb/dev-network.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/dev-network.c +2 -1
index ba3c7a7..180adce 100644
@@ -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,
Signature · 1 line
2.5.0
#1 lore raw
Quoted 4 lines · P J P

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.

Added to usb queue.

thanks,
Gerd