linux-stable/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 usb: atm: Use struct_size() helper 2021-10-05 12:50:22 +02:00
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 Merge 5.15-rc5 into usb-next 2021-10-11 07:39:38 +02:00
common Partially revert "usb: Kconfig: using select for USB_COMMON dependency" 2021-10-05 13:45:16 +02:00
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 scsi: core: Remove the 'done' argument from SCSI queuecommand_lck functions 2021-10-16 21:32:16 -04:00
isp1760 usb: isp1760: otg control register access 2021-08-27 16:11:39 +02:00
misc USB: iowarrior: fix control-message timeouts 2021-10-26 19:12:28 +02:00
mon
mtu3 usb: mtu3: enable wake-up interrupt after runtime_suspend called 2021-10-27 20:49:32 +02:00
musb usb: musb: Balance list entry in musb_gadget_queue 2021-10-22 11:12:45 +02:00
phy USB: phy: tahvo:remove unnecessary debug log 2021-10-05 12:51:07 +02:00
renesas_usbhs usb: renesas_usbhs: Fix spelling mistake "faile" -> "failed" 2021-08-27 10:29:32 +02:00
roles usb: roles: add helper usb_role_string() 2021-05-27 09:17:18 +02:00
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 usbip:vhci_hcd USB port can get stuck in the disabled state 2021-08-26 13:29:27 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile usb: host: remove line for obsolete config USB_HWA_HCD 2021-08-18 15:32:19 +02:00
usb-skeleton.c usb: usb-skeleton: Update min() to min_t() 2021-10-05 12:56:48 +02:00