* [PATCH] net/temac: FIX segfault when process old irqs
@ 2011-11-08 9:29 Ricardo Ribalda Delgado
0 siblings, 0 replies; 3+ messages in thread
From: Ricardo Ribalda Delgado @ 2011-11-08 9:29 UTC (permalink / raw)
To: open list:NETWORKING DRIVERS, open list; +Cc: Ricardo Ribalda Delgado
Do not enable the irq until the scatter gather registers are ready to
handle the data. Otherwise an irq from a packet send/received before
last close can lead to an access to an invalid memory region on the irq
handler.
Also, stop the dma engine on close.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 4d1658e..c8db76a 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -203,6 +203,9 @@ static void temac_dma_bd_release(struct net_device *ndev)
struct temac_local *lp = netdev_priv(ndev);
int i;
+ /* Reset Local Link (DMA) */
+ lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
+
for (i = 0; i < RX_BD_NUM; i++) {
if (!lp->rx_skb[i])
break;
@@ -860,6 +863,8 @@ static int temac_open(struct net_device *ndev)
phy_start(lp->phy_dev);
}
+ temac_device_reset(ndev);
+
rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev);
if (rc)
goto err_tx_irq;
@@ -867,7 +872,6 @@ static int temac_open(struct net_device *ndev)
if (rc)
goto err_rx_irq;
- temac_device_reset(ndev);
return 0;
err_rx_irq:
--
1.7.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/temac: FIX segfault when process old irqs
2011-11-08 9:31 Ricardo Ribalda Delgado
@ 2011-11-09 20:39 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2011-11-09 20:39 UTC (permalink / raw)
To: ricardo.ribalda
Cc: ian.campbell, eric.dumazet, jeffrey.t.kirsher, jpirko, netdev,
linux-kernel
From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date: Tue, 8 Nov 2011 10:31:58 +0100
> Do not enable the irq until the scatter gather registers are ready to
> handle the data. Otherwise an irq from a packet send/received before
> last close can lead to an access to an invalid memory region on the irq
> handler.
>
> Also, stop the dma engine on close.
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] net/temac: FIX segfault when process old irqs
@ 2011-11-08 9:31 Ricardo Ribalda Delgado
2011-11-09 20:39 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Ribalda Delgado @ 2011-11-08 9:31 UTC (permalink / raw)
To: davem, ian.campbell, eric.dumazet, jeffrey.t.kirsher, jpirko,
netdev, linux-kernel
Cc: Ricardo Ribalda Delgado
Do not enable the irq until the scatter gather registers are ready to
handle the data. Otherwise an irq from a packet send/received before
last close can lead to an access to an invalid memory region on the irq
handler.
Also, stop the dma engine on close.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 4d1658e..c8db76a 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -203,6 +203,9 @@ static void temac_dma_bd_release(struct net_device *ndev)
struct temac_local *lp = netdev_priv(ndev);
int i;
+ /* Reset Local Link (DMA) */
+ lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
+
for (i = 0; i < RX_BD_NUM; i++) {
if (!lp->rx_skb[i])
break;
@@ -860,6 +863,8 @@ static int temac_open(struct net_device *ndev)
phy_start(lp->phy_dev);
}
+ temac_device_reset(ndev);
+
rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev);
if (rc)
goto err_tx_irq;
@@ -867,7 +872,6 @@ static int temac_open(struct net_device *ndev)
if (rc)
goto err_rx_irq;
- temac_device_reset(ndev);
return 0;
err_rx_irq:
--
1.7.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-09 20:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08 9:29 [PATCH] net/temac: FIX segfault when process old irqs Ricardo Ribalda Delgado
2011-11-08 9:31 Ricardo Ribalda Delgado
2011-11-09 20:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).