All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "USB: host: ohci-at91: fix a crash in ohci_hcd_at91_overcurrent_irq" has been added to the 4.3-stable tree
@ 2015-12-17 23:01 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-12-17 23:01 UTC (permalink / raw)
  To: alexandre.belloni, gregkh, nicolas.ferre, peda, stern
  Cc: stable, stable-commits


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

    USB: host: ohci-at91: fix a crash in ohci_hcd_at91_overcurrent_irq

to the 4.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-host-ohci-at91-fix-a-crash-in-ohci_hcd_at91_overcurrent_irq.patch
and it can be found in the queue-4.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 4a0c4c36094cefd85cbe489590382ef69516ccef Mon Sep 17 00:00:00 2001
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Date: Wed, 2 Dec 2015 20:36:55 +0100
Subject: USB: host: ohci-at91: fix a crash in ohci_hcd_at91_overcurrent_irq

From: Alexandre Belloni <alexandre.belloni@free-electrons.com>

commit 4a0c4c36094cefd85cbe489590382ef69516ccef upstream.

The interrupt handler, ohci_hcd_at91_overcurrent_irq may be called right
after registration. At that time, pdev->dev.platform_data is not yet set,
leading to a NULL pointer dereference.

Fixes: e4df92279fd9 (USB: host: ohci-at91: merge loops in ohci_hcd_at91_drv_probe)
Reported-by: Peter Rosin <peda@axentia.se>
Tested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/ohci-at91.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -473,6 +473,8 @@ static int ohci_hcd_at91_drv_probe(struc
 	if (!pdata)
 		return -ENOMEM;
 
+	pdev->dev.platform_data = pdata;
+
 	if (!of_property_read_u32(np, "num-ports", &ports))
 		pdata->ports = ports;
 
@@ -483,6 +485,7 @@ static int ohci_hcd_at91_drv_probe(struc
 		 */
 		if (i >= pdata->ports) {
 			pdata->vbus_pin[i] = -EINVAL;
+			pdata->overcurrent_pin[i] = -EINVAL;
 			continue;
 		}
 
@@ -513,10 +516,8 @@ static int ohci_hcd_at91_drv_probe(struc
 	}
 
 	at91_for_each_port(i) {
-		if (i >= pdata->ports) {
-			pdata->overcurrent_pin[i] = -EINVAL;
-			continue;
-		}
+		if (i >= pdata->ports)
+			break;
 
 		pdata->overcurrent_pin[i] =
 			of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
@@ -552,8 +553,6 @@ static int ohci_hcd_at91_drv_probe(struc
 		}
 	}
 
-	pdev->dev.platform_data = pdata;
-
 	device_init_wakeup(&pdev->dev, 1);
 	return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
 }


Patches currently in stable-queue which might be from alexandre.belloni@free-electrons.com are

queue-4.3/usb-host-ohci-at91-fix-a-crash-in-ohci_hcd_at91_overcurrent_irq.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-17 23:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-17 23:01 Patch "USB: host: ohci-at91: fix a crash in ohci_hcd_at91_overcurrent_irq" has been added to the 4.3-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.