summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreetham Chandru <pchandru@nvidia.com>2012-08-09 13:51:39 +0530
committerMatthew Pedro <mapedro@nvidia.com>2012-08-20 11:49:04 -0700
commit4a01065c582513cafa31f7da1acdeca3a6561771 (patch)
tree92633a7855e5508b77360878ef98d8e38ca83f0a
parentd271f6bb9a48fa382cbc17afadfc1453e94bb234 (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> Reviewed-on: http://git-master/r/122390 (cherry picked from commit 642d37a0eee196d0ce811dd11bb7af5ba281ee3a) Change-Id: I00d6cb185cd2314cccb56f968eb0a05288588c13 Reviewed-on: http://git-master/r/123907 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
-rw-r--r--drivers/usb/host/ehci-tegra.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index b2747762a7ed..33504e402611 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)