From: John W. Linville Date: Tue, 6 Jan 2015 19:49:47 +0000 (-0500) Subject: usb: gadget: udc: avoid dereference before NULL check in ep_queue X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f26d29e34e203296140334087fa3c81168626d76;p=linux-beck.git usb: gadget: udc: avoid dereference before NULL check in ep_queue Coverity: CID 1260069 Signed-off-by: John W. Linville Cc: Felipe Balbi Cc: stable Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index ff67ceac77c4..d4fe8d769bd6 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c @@ -718,10 +718,11 @@ static int ep_queue(struct bdc_ep *ep, struct bdc_req *req) struct bdc *bdc; int ret = 0; - bdc = ep->bdc; if (!req || !ep || !ep->usb_ep.desc) return -EINVAL; + bdc = ep->bdc; + req->usb_req.actual = 0; req->usb_req.status = -EINPROGRESS; req->epnum = ep->ep_num;