Skip to content

Commit 37ec274

Browse files
Eric Dumazetdavem330
authored andcommitted
arc_emac: fix potential use after free
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: e4f2379 ("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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3756791 commit 37ec274

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/net/ethernet/arc/emac_main.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
565565
/* Make sure pointer to data buffer is set */
566566
wmb();
567567

568+
skb_tx_timestamp(skb);
569+
568570
*info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);
569571

570572
/* 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)
579581

580582
arc_reg_set(priv, R_STATUS, TXPL_MASK);
581583

582-
skb_tx_timestamp(skb);
583-
584584
return NETDEV_TX_OK;
585585
}
586586

0 commit comments

Comments
 (0)