aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fec_main.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-12-19 13:53:02 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-15 18:28:48 -0500
commitcf3daa7cbcf9ac14a7549239d7ff3464138a79c8 (patch)
treebeb03156cfedbf1146bd8f681ddb017dd3ff67e3 /drivers/net/ethernet/freescale/fec_main.c
parent8f3843be6e6d1fcc5bcdad42b569a5d4797d9d1f (diff)
net: fec: fix potential use after free
[ Upstream commit 7a2a84518cfb263d2c4171b3d63671f88316adb2 ] 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. Signed-off-by: Eric Dumazet <edumazet@google.com> Fixes: de5fb0a05348 ("net: fec: put tx to napi poll function to fix dead lock") Cc: Frank Li <Frank.Li@freescale.com> Cc: Richard Cochran <richardcochran@gmail.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec_main.c')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d48099f03b7f..fbd0d7df67d8 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -371,6 +371,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
371 else 371 else
372 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); 372 bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex);
373 373
374 skb_tx_timestamp(skb);
375
374 fep->cur_tx = bdp; 376 fep->cur_tx = bdp;
375 377
376 if (fep->cur_tx == fep->dirty_tx) 378 if (fep->cur_tx == fep->dirty_tx)
@@ -379,8 +381,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
379 /* Trigger transmission start */ 381 /* Trigger transmission start */
380 writel(0, fep->hwp + FEC_X_DES_ACTIVE); 382 writel(0, fep->hwp + FEC_X_DES_ACTIVE);
381 383
382 skb_tx_timestamp(skb);
383
384 return NETDEV_TX_OK; 384 return NETDEV_TX_OK;
385} 385}
386 386