usb: check USB configuration descriptor object
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.
Reported-by Qinghao Tang <[email protected]>
Signed-off-by Prasad J Pandit <[email protected]>
--- hw/usb/dev-network.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/dev-network.c +2 -1
@@ -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
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