Skip to content

Commit aba57a8

Browse files
robhancockseddavem330
authored andcommitted
net: axienet: fix number of TX ring slots for available check
The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use. Fixes: 8a3b7a2 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 996defd commit aba57a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
747747
num_frag = skb_shinfo(skb)->nr_frags;
748748
cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
749749

750-
if (axienet_check_tx_bd_space(lp, num_frag)) {
750+
if (axienet_check_tx_bd_space(lp, num_frag + 1)) {
751751
if (netif_queue_stopped(ndev))
752752
return NETDEV_TX_BUSY;
753753

@@ -757,7 +757,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
757757
smp_mb();
758758

759759
/* Space might have just been freed - check again */
760-
if (axienet_check_tx_bd_space(lp, num_frag))
760+
if (axienet_check_tx_bd_space(lp, num_frag + 1))
761761
return NETDEV_TX_BUSY;
762762

763763
netif_wake_queue(ndev);

0 commit comments

Comments
 (0)