All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usb: check USB configuration descriptor object
@ 2016-02-11 11:01 P J P
  2016-02-16 13:34 ` Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: P J P @ 2016-02-11 11:01 UTC (permalink / raw)
  To: Qemu Developers; +Cc: Qinghao Tang, Gerd Hoffmann, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

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>
---
 hw/usb/dev-network.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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,
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] usb: check USB configuration descriptor object
  2016-02-11 11:01 [Qemu-devel] [PATCH] usb: check USB configuration descriptor object P J P
@ 2016-02-16 13:34 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2016-02-16 13:34 UTC (permalink / raw)
  To: P J P; +Cc: Qinghao Tang, Qemu Developers, Prasad J Pandit

On Do, 2016-02-11 at 16:31 +0530, P J P wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-16 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 11:01 [Qemu-devel] [PATCH] usb: check USB configuration descriptor object P J P
2016-02-16 13:34 ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.