From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9FJ1-0003YW-Gb for barebox@lists.infradead.org; Mon, 21 Jul 2014 15:15:14 +0000 From: Sascha Hauer Date: Mon, 21 Jul 2014 17:14:45 +0200 Message-Id: <1405955687-27433-22-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1405955687-27433-1-git-send-email-s.hauer@pengutronix.de> References: <1405955687-27433-1-git-send-email-s.hauer@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 21/23] USB: gadget: fsl_udc: Be more tolerant in fsl_ep_dequeue To: barebox@lists.infradead.org When an endpoint hasn't been enabled ep->desc is NULL and fsl_ep_dequeue crashes with a NULL pointer dereference. Check ep->desc before continuing. Signed-off-by: Sascha Hauer --- drivers/usb/gadget/fsl_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c index 5266fb6..5a625d1 100644 --- a/drivers/usb/gadget/fsl_udc.c +++ b/drivers/usb/gadget/fsl_udc.c @@ -1280,7 +1280,7 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) int ep_num, stopped, ret = 0; u32 epctrl; - if (!_ep || !_req) + if (!_ep || !_req || !ep->desc) return -EINVAL; stopped = ep->stopped; -- 2.0.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox