diff options
author | Preetham Chandru <pchandru@nvidia.com> | 2012-08-09 13:51:39 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-10 23:10:44 -0700 |
commit | 642d37a0eee196d0ce811dd11bb7af5ba281ee3a (patch) | |
tree | 046497daf128c603be9cb1651044a68eb1aa5127 | |
parent | c065d9e47085fbb98924d986c3915f279e504fc8 (diff) |
usb: ehci: tegra: Fix Slab corruption error
Give ownership of the DMA buffer back to the processor first and
then free the buffer. Otherwise processor won't be able to
access the dma mapped buffers and this would lead to slab
corruption.
When the DMA buffer is freed without a call to dma_sync_single_for_cpu(),
the kernel won't be able to set the buffer as POISON FREE and when we
acquire this memory back again the kernel will start printing slab
corruption output as the memory is not set to POISON FREE
Bug 1017884
Bug 1018161
Reviewed-on: http://git-master/r/#change,122151
Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
Change-Id: I00d6cb185cd2314cccb56f968eb0a05288588c13
Reviewed-on: http://git-master/r/122390
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 08f12be6dbd0..af6fa87fb645 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -137,8 +137,6 @@ static int tegra_ehci_map_urb_for_dma(struct usb_hcd *hcd, static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) { - usb_hcd_unmap_urb_for_dma(hcd, urb); - free_align_buffer(urb); if (urb->transfer_dma) { enum dma_data_direction dir; @@ -148,6 +146,9 @@ static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd *hcd, urb->transfer_dma, urb->transfer_buffer_length, DMA_FROM_DEVICE); } + + usb_hcd_unmap_urb_for_dma(hcd, urb); + free_align_buffer(urb); } static irqreturn_t tegra_ehci_irq(struct usb_hcd *hcd) |