public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/1] net/fec: do not pass NULL dev to DMA API
@ 2011-04-02  6:39 Aisheng.Dong
  2011-04-02  7:57 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Aisheng.Dong @ 2011-04-02  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

Fec will crash when DMABOUNCE is enabled.
Unable to handle kernel NULL pointer dereference at virtual address 000000bc
pgd = 80004000
[000000bc] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT
last sysfs file:
Modules linked in:
CPU: 0    Not tainted  (2.6.35.3-00845-g204c152-dirty #112)
PC is at dma_map_single+0x2c/0x2a0
LR is at fec_enet_interrupt+0x1d4/0x450

The reason is DMA API of dmabounce needs the dev passed in is not NULL.

Here we'd always pass in a struct device if there is one available
for using DMA API to improve the code robustness sicne it may not
always work when passing a NULL dev.

Signed-off-by: Aisheng.Dong <b29396@freescale.com>
---
 drivers/net/fec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index cd0282d..89a2ba4 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -527,7 +527,7 @@ fec_enet_rx(struct net_device *dev)
 		dev->stats.rx_bytes += pkt_len;
 		data = (__u8*)__va(bdp->cbd_bufaddr);
 
-	        dma_unmap_single(NULL, bdp->cbd_bufaddr, bdp->cbd_datlen,
+		dma_unmap_single(&dev->dev, bdp->cbd_bufaddr, bdp->cbd_datlen,
         			DMA_FROM_DEVICE);
 
 		if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME)
@@ -552,7 +552,7 @@ fec_enet_rx(struct net_device *dev)
 			netif_rx(skb);
 		}
 
-        	bdp->cbd_bufaddr = dma_map_single(NULL, data, bdp->cbd_datlen,
+		bdp->cbd_bufaddr = dma_map_single(&dev->dev, data, bdp->cbd_datlen,
 			DMA_FROM_DEVICE);
 rx_processing_done:
 		/* Clear the status flags for this buffer */
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-04-02  8:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-02  6:39 [PATCH 1/1] net/fec: do not pass NULL dev to DMA API Aisheng.Dong
2011-04-02  7:57 ` David Miller
2011-04-02  8:31   ` Shawn Guo
2011-04-02  8:34     ` David Miller
2011-04-02  8:35     ` Jason Liu
2011-04-02  8:35       ` David Miller
2011-04-02  8:40         ` Dong Aisheng-B29396

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox