Received: from eggs.gnu.org ([2001:4830:134:3::10]:38170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTp0B-0004x7-Uz for qemu-devel@nongnu.org; Thu, 11 Feb 2016 06:01:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTp04-0003A0-70 for qemu-devel@nongnu.org; Thu, 11 Feb 2016 06:01:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTp04-00039m-1b for qemu-devel@nongnu.org; Thu, 11 Feb 2016 06:01:28 -0500 From: P J P Date: Thu, 11 Feb 2016 16:31:20 +0530 Message-Id: <1455188480-14688-1-git-send-email-ppandit@redhat.com> Subject: [Qemu-devel] [PATCH] usb: check USB configuration descriptor object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu Developers Cc: Qinghao Tang , Gerd Hoffmann , Prasad J Pandit From: Prasad J Pandit 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 Signed-off-by: Prasad J Pandit --- 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