]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc3: gadget: Fix null pointer exception
authorAlbert Wang <albertccwang@google.com>
Tue, 9 Nov 2021 09:26:42 +0000 (17:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Nov 2021 14:02:52 +0000 (15:02 +0100)
commit9fc42dced82f8d4b82d5e873cfede08fe4cc0931
tree00e7f6ffda29077082a134f781ed050b8783d2aa
parent01a37c175cea48fa0826d67b5e3483f800abacb2
usb: dwc3: gadget: Fix null pointer exception

In the endpoint interrupt functions
dwc3_gadget_endpoint_transfer_in_progress() and
dwc3_gadget_endpoint_trbs_complete() will dereference the endpoint
descriptor. But it could be cleared in __dwc3_gadget_ep_disable()
when accessory disconnected. So we need to check whether it is null
or not before dereferencing it.

Fixes: c649add66822 ("usb: dwc3: gadget: Prevent EP queuing while stopping transfers")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Jack Pham <quic_jackp@quicinc.com>
Signed-off-by: Albert Wang <albertccwang@google.com>
Link: https://lore.kernel.org/r/20211109092642.3507692-1-albertccwang@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c