UPSTREAM: usb: dwc3: gadget: fix for possible endpoint disable race
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 18 May 2016 09:37:21 +0000 (12:37 +0300)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 16 Aug 2016 12:48:19 +0000 (20:48 +0800)
commitad99d0b25174ac2ff5ad55fcddf092fcc8c4b140
tree8fcb2abef9cd402ea4ac71cf1746347d3197e393
parentfda77e79d79d82ccf3dd6551de4b267789879729
UPSTREAM: usb: dwc3: gadget: fix for possible endpoint disable race

when we call dwc3_gadget_giveback(), we end up
releasing our controller's lock. Another thread
could get scheduled and disable the endpoint,
subsequently setting dep->endpoint.desc to NULL.

In that case, we would end up dereferencing a NULL
pointer which would result in a Kernel Oops. Let's
avoid the problem by simply returning early if we
have a NULL descriptor.

Change-Id: Ib2ee62e6e93ad47385f2a2d57191cbe32c720110
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 4cb4221764ef473cd36e1953f1fea11865786d65)
drivers/usb/dwc3/gadget.c