linux/drivers/usb
Stepan Ionichev 5bf5e3fba9 usb: gadget: goku_udc: avoid NULL deref of dev->driver in INT_USBRESET log
goku_irq() handles a number of bus events under a single ep0 path.
It already guards the gadget driver suspend/resume callbacks against a
NULL ->driver:

	if (dev->gadget.speed != USB_SPEED_UNKNOWN
			&& dev->driver
			&& dev->driver->resume) {
		spin_unlock(&dev->lock);
		dev->driver->resume(&dev->gadget);
		...
	}

but the very next branch unconditionally dereferences dev->driver
when an INT_USBRESET arrives:

	if (stat & INT_USBRESET) {
		ACK(INT_USBRESET);
		INFO(dev, "USB reset done, gadget %s\n",
			dev->driver->driver.name);
	}

If the controller raises INT_USBRESET before any gadget driver has
been bound (or after one has been unbound), dev->driver is NULL and
the printk dereferences NULL.

smatch flags the inconsistency:

  drivers/usb/gadget/udc/goku_udc.c:1618 goku_irq() error:
  we previously assumed 'dev->driver' could be null (see line 1607)

Fall back to a placeholder when the gadget driver is not bound.

No functional change while a gadget driver is bound.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Link: https://patch.msgid.link/20260509110636.19762-1-sozdayvek@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-05-22 11:34:41 +02:00
..
atm usb: atm: ueagle-atm: remove function entry/exit debug messages 2026-05-21 16:43:08 +02:00
c67x00 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cdns3 usb: cdns3: Add USBSSP platform driver support 2026-04-27 05:14:18 -06:00
chipidea usb: chipidea: udc: support dynamic gadget add/remove 2026-05-22 11:28:10 +02:00
class usb: usblp: fix uninitialized heap leak via LPGETSTATUS ioctl 2026-04-27 10:00:18 -06:00
common usb: ulpi: fix memory leak on ulpi_register() error paths 2026-04-27 09:49:43 -06:00
core usb: core: hcd: fix possible deadlock in rh control transfers 2026-05-22 11:34:24 +02:00
dwc2 usb: dwc2: gadget: Fix spin_lock/unlock mismatch in dwc2_hsotg_udc_stop() 2026-03-30 17:05:07 +02:00
dwc3 usb: dwc3: dwc3-octeon: Use FIELD_MODIFY() 2026-05-21 16:43:04 +02:00
early usb: early: xhci-dbc: Fix early_ioremap leak 2025-07-07 11:04:46 +02:00
fotg210 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
gadget usb: gadget: goku_udc: avoid NULL deref of dev->driver in INT_USBRESET log 2026-05-22 11:34:41 +02:00
host usb: xhci-pci: add AMD Promontory 21 PCI glue 2026-05-21 16:48:40 +02:00
image Merge 7.0-rc4 into usb-next 2026-03-16 11:50:48 +01:00
isp1760 Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
misc usb: misc: Use named initializers for struct i2c_device_id 2026-05-21 16:52:34 +02:00
mon Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
mtu3 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
musb usb: musb: Use safer strscpy() instead of strcpy() 2026-03-11 15:39:04 +01:00
phy usb: phy: isp1301: Use named initializers for struct i2c_device_id 2026-05-21 16:52:36 +02:00
renesas_usbhs usb: renesas_usbhs: use kzalloc_flex 2026-03-18 15:51:48 +01:00
roles usb: roles: get usb role switch from parent only for usb-b-connector 2026-03-11 16:22:22 +01:00
serial USB: serial: option: add Telit Cinterion LE910Cx compositions 2026-04-30 10:53:56 +02:00
storage usb: storage: Expand range of matched versions for VL817 quirks entry 2026-04-07 13:47:23 +02:00
typec usb: typec: intel_pmc_mux: Zero initialize num_ports in pmc_usb_probe() 2026-05-22 11:34:36 +02:00
usbip usbip: vhci_hcd: reduce CONFIG_USBIP_VHCI_NR_HCS upper bound to 32 2026-05-22 11:34:27 +02:00
Kconfig usb: pci-quirks: handle HAS_IOPORT dependency for AMD quirk 2023-10-02 16:19:12 +02:00
Makefile usb: cdns3: Add USBSSP platform driver support 2026-04-27 05:14:18 -06:00
usb-skeleton.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00