aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/hcd.c
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2014-02-04 14:21:24 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-04 15:59:14 -0500
commit51b1b6491752ac066ee8d32cc66042fcc955fef6 (patch)
treef2446587ac2ada418ddedb81dd1eca45245127fc /drivers/usb/dwc2/hcd.c
parenta23666c49938bba08df3654fc66cd051587f7673 (diff)
usb: dwc2: fix memory corruption in dwc2 driver
The move from the staging tree to the main tree exposed a longstanding memory corruption bug in the dwc2 driver. The reordering of the driver initialization caused the dwc2 driver to corrupt the initialization data of the sdhci driver on the Raspberry Pi platform, which made the bug show up. The error is in calling to_usb_device(hsotg->dev), since ->dev is not a member of struct usb_device. The easiest fix is to just remove the offending code, since it is not really needed. Thanks to Stephen Warren for tracking down the cause of this. Reported-by: Andre Heider <a.heider@gmail.com> Tested-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc2/hcd.c')
-rw-r--r--drivers/usb/dwc2/hcd.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index f59484d43b35..4d918ed8d343 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -2565,25 +2565,14 @@ static void _dwc2_hcd_endpoint_reset(struct usb_hcd *hcd,
2565 struct usb_host_endpoint *ep) 2565 struct usb_host_endpoint *ep)
2566{ 2566{
2567 struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); 2567 struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
2568 int is_control = usb_endpoint_xfer_control(&ep->desc);
2569 int is_out = usb_endpoint_dir_out(&ep->desc);
2570 int epnum = usb_endpoint_num(&ep->desc);
2571 struct usb_device *udev;
2572 unsigned long flags; 2568 unsigned long flags;
2573 2569
2574 dev_dbg(hsotg->dev, 2570 dev_dbg(hsotg->dev,
2575 "DWC OTG HCD EP RESET: bEndpointAddress=0x%02x\n", 2571 "DWC OTG HCD EP RESET: bEndpointAddress=0x%02x\n",
2576 ep->desc.bEndpointAddress); 2572 ep->desc.bEndpointAddress);
2577 2573
2578 udev = to_usb_device(hsotg->dev);
2579
2580 spin_lock_irqsave(&hsotg->lock, flags); 2574 spin_lock_irqsave(&hsotg->lock, flags);
2581
2582 usb_settoggle(udev, epnum, is_out, 0);
2583 if (is_control)
2584 usb_settoggle(udev, epnum, !is_out, 0);
2585 dwc2_hcd_endpoint_reset(hsotg, ep); 2575 dwc2_hcd_endpoint_reset(hsotg, ep);
2586
2587 spin_unlock_irqrestore(&hsotg->lock, flags); 2576 spin_unlock_irqrestore(&hsotg->lock, flags);
2588} 2577}
2589 2578