usb: dwc3: pci: reject matches without software-node data
Subsystems (3)
PATCH 1/1 usb: dwc3: pci: reject matches without software-node data
A PCI driver_override bind can reach dwc3_pci_probe() with the dummy ID from pci_match_device(). Its driver_data is zero, so dwc3_pci_quirks() passes NULL to device_add_software_node(), which crashes in software_node_register().
Reject the match before enabling the device or allocating resources. All static DWC3 PCI IDs provide software-node data.
Build-tested with ARCH=arm64 defconfig and dwc3-pci.o. The runtime reproducer could not be run in this environment.
--- drivers/usb/dwc3/dwc3-pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +3 -0
@@ -335,6 +335,9 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)int ret;struct device *dev = &pci->dev; +if (!id->driver_data) +return -ENODEV ; + ret =pcim_enable_device (pci);if (ret) {dev_err (dev,"failed to enable pci device\n" );
Signature · 1 line
2.55.0
Benjamin Marzinski
maintainerThese aren't the appropriate people or list to send this patch to.
scripts/get_maintainer.pl is your friend here.
repos/linux$ scripts/get_maintainer.pl 0001-usb-dwc3-pci-reject-matches-without-software-node-da.patch Thinh Nguyen <[email protected]> (maintainer:DESIGNWARE USB3 DRD IP DRIVER) Greg Kroah-Hartman <[email protected]> (maintainer:USB SUBSYSTEM,blamed_fixes:1/1=100%) Heikki Krogerus <[email protected]> (blamed_fixes:1/1=100%)
Felipe Balbi <[email protected]> (blamed_fixes:1/1=100%)
[email protected] (open list:DESIGNWARE USB3 DRD IP DRIVER) [email protected] (open list)
USB SUBSYSTEM status: Supported
So Thinh Nguyen <[email protected]> is the maintainer for this driver, Greg Kroah-Hartman <[email protected]> is the maintainer for the subsystem, [email protected] is the mailing list for this driver, and Heikki Krogerus <[email protected]>, Greg Kroah-Hartman <[email protected]>, and Felipe Balbi <[email protected]> all have something to do with e492ce9bcaa1 ("usb: dwc3: pci: Register a software node for the dwc3 platform device").
-Ben
Quoted 36 lines · By
A PCI
driver_overridebind can reachdwc3_pci_probe()with the dummy ID frompci_match_device(). Itsdriver_datais zero, sodwc3_pci_quirks()passes NULL todevice_add_software_node(), which crashes insoftware_node_register().Reject the match before enabling the device or allocating resources. All static DWC3 PCI IDs provide software-node data.
Build-tested with ARCH=arm64 defconfig and dwc3-pci.o. The runtime reproducer could not be run in this environment.
Fixes e492ce9bcaa1 ("usb: dwc3: pci: Register a software node for the dwc3 platform device")Reported-by [email protected]Assisted-by LLMSigned-off-by By <[email protected]>--- drivers/usb/dwc3/dwc3-pci.c | 3 +++ 1 file changed, 3 insertions(+)drivers/usb/dwc3/dwc3-pci.c +3
-0@@ -335,6 +335,9 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)int ret;struct device *dev = &pci->dev; +if (!id->driver_data) +return -ENODEV ; + ret =pcim_enable_device (pci);if (ret) {dev_err (dev,"failed to enable pci device\n" );Signature · 1 line
2.55.0