usb: dwc3: gadget: Acquire spin_lock before checking usb_ep->desc

usb_ep's desc field is marked as NULL in ep_disable which gets
called on cable disconnect. Currently, ep_queue function is
checking for ep->desc before acquiring spin_lock. If USB cable
gets disconnected after ep->desc check but before spin_lock is
acquired then there are chances of hitting NULL pointer
dereference subsequently when ep_queue function later tries to
access ep->desc. Fix this by acquiring spin_lock before ep->desc
check in ep_queue.

CRs-Fixed: 454236
Change-Id: Icd7c2cf5ea3583759143555521ce44403f20e2bd
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
1 file changed