Skip to contentSkip to conversation

patch "usb: dwc3: Fix NULL pointer exception in dwc3_pci_remove()" added to usb-linus

PATCH [email protected] 1 participant 1 message Nov 15, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: dwc3: Fix NULL pointer exception in dwc3_pci_remove()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 7b412b04a0c7000293008231ce8413056abb1982 Mon Sep 17 00:00:00 2001

From: Kuppuswamy Sathyanarayanan <[email protected]>
Date: Wed, 17 Oct 2018 11:40:26 -0700
Subject: usb: dwc3: Fix NULL pointer exception in dwc3_pci_remove()

In dwc3_pci_quirks() function, gpiod lookup table is only registered for baytrail SOC. But in dwc3_pci_remove(), we try to unregistered it without any checks. This leads to NULL pointer de-reference exception in gpiod_remove_lookup_table() when unloading the module for non baytrail SOCs. This patch fixes this issue.

Fixes 5741022cbdf3 ("usb: dwc3: pci: Add GPIO lookup table on platforms

without ACPI GPIO resources")

---
 drivers/usb/dwc3/dwc3-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-pci.c +3 -1
index 1286076a8890..842795856bf4 100644
@@ -283,8 +283,10 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
 static void dwc3_pci_remove(struct pci_dev *pci)
 {
 	struct dwc3_pci		*dwc = pci_get_drvdata(pci);
+	struct pci_dev		*pdev = dwc->pci;
 
-	gpiod_remove_lookup_table(&platform_bytcr_gpios);
+	if (pdev->device == PCI_DEVICE_ID_INTEL_BYT)
+		gpiod_remove_lookup_table(&platform_bytcr_gpios);
 #ifdef CONFIG_PM
 	cancel_work_sync(&dwc->wakeup_work);
 #endif
Signature · 1 line
2.19.1