WSL2-Linux-Kernel/drivers/usb
Zhou Qingyang 37307f7020 usb: cdnsp: Fix a NULL pointer dereference in cdnsp_endpoint_init()
In cdnsp_endpoint_init(), cdnsp_ring_alloc() is assigned to pep->ring
and there is a dereference of it in cdnsp_endpoint_init(), which could
lead to a NULL pointer dereference on failure of cdnsp_ring_alloc().

Fix this bug by adding a check of pep->ring.

This bug was found by a static analyzer. The analysis employs
differential checking to identify inconsistent security operations
(e.g., checks or kfrees) between two code paths and confirms that the
inconsistent operations are not recovered in the current function or
the callers, so they constitute bugs.

Note that, as a bug found by static analysis, it can be a false
positive or hard to trigger. Multiple researchers have cross-reviewed
the bug.

Builds with CONFIG_USB_CDNSP_GADGET=y show no new warnings,
and our static analyzer no longer warns about this code.

Fixes: 3d82904559 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Cc: stable <stable@vger.kernel.org>
Acked-by: Pawel Laszczak <pawell@cadence.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Zhou Qingyang <zhou1615@umn.edu>
Link: https://lore.kernel.org/r/20211130172700.206650-1-zhou1615@umn.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03 13:57:45 +01:00
..
atm
c67x00
cdns3 usb: cdnsp: Fix a NULL pointer dereference in cdnsp_endpoint_init() 2021-12-03 13:57:45 +01:00
chipidea usb: chipidea: ci_hdrc_imx: fix potential error pointer dereference in probe 2021-11-17 15:05:18 +01:00
class
common
core USB: NO_LPM quirk Lenovo Powered USB-C Travel Hub 2021-12-03 13:56:54 +01:00
dwc2 usb: dwc2: hcd_queue: Fix use of floating point literal 2021-11-17 15:03:34 +01:00
dwc3 usb: dwc3: leave default DMA for PCI devices 2021-11-17 15:03:51 +01:00
early memblock: rename memblock_free to memblock_phys_free 2021-11-06 13:30:41 -07:00
gadget usb: gadget: udc-xilinx: Fix an error handling path in 'xudc_probe()' 2021-11-17 15:02:34 +01:00
host xhci: Fix commad ring abort, write all 64 bits to CRCR register. 2021-12-03 13:56:33 +01:00
image
isp1760
misc
mon
mtu3
musb
phy
renesas_usbhs
roles
serial USB: serial: option: add Fibocom FM101-GL variants 2021-11-24 19:03:31 +01:00
storage SCSI misc on 20211105 2021-11-05 08:42:02 -07:00
typec usb: typec: tcpm: Wait in SNK_DEBOUNCED until disconnect 2021-12-03 13:57:10 +01:00
usbip
Kconfig
Makefile
usb-skeleton.c