public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arc_emac: fix
@ 2013-12-20  1:58 Eric Dumazet
  2013-12-20  2:05 ` Eric Dumazet
  2013-12-20  2:10 ` [PATCH v2] arc_emac: fix potential use after free Eric Dumazet
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2013-12-20  1:58 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Alexey Brodkin, Richard Cochran

Signed-off-by: Eric Dumazet <edumazet@google.com>

skb_tx_timestamp(skb) should be called _before_ TX completion
has a chance to trigger, otherwise it is too late and we access
freed memory.

Fixes: e4f2379db6c6 ("ethernet/arc/arc_emac - Add new driver")
From: Eric Dumazet <edumazet@google.com>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/arc/emac_main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index b2ffad1304d2..248baf6273fb 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -565,6 +565,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
 	/* Make sure pointer to data buffer is set */
 	wmb();
 
+	skb_tx_timestamp(skb);
+
 	*info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);
 
 	/* Increment index to point to the next BD */
@@ -579,8 +581,6 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
 
 	arc_reg_set(priv, R_STATUS, TXPL_MASK);
 
-	skb_tx_timestamp(skb);
-
 	return NETDEV_TX_OK;
 }
 

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

end of thread, other threads:[~2013-12-27 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20  1:58 [PATCH] arc_emac: fix Eric Dumazet
2013-12-20  2:05 ` Eric Dumazet
2013-12-20  2:10 ` [PATCH v2] arc_emac: fix potential use after free Eric Dumazet
2013-12-20 14:06   ` Alexey Brodkin
2013-12-27 18:05   ` David Miller

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