Skip to content

Commit

Permalink
net: ll_temac: Fix TX BD buffer overwrite
Browse files Browse the repository at this point in the history
commit c364df2 upstream.

Just as the initial check, we need to ensure num_frag+1 buffers available,
as that is the number of buffers we are going to use.

This fixes a buffer overflow, which might be seen during heavy network
load. Complete lockup of TEMAC was reproducible within about 10 minutes of
a particular load.

Fixes: 84823ff ("net: ll_temac: Fix race condition causing TX hang")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
esben authored and gregkh committed Jun 23, 2021
1 parent 019ab7d commit cfe403f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/xilinx/ll_temac_main.c
Expand Up @@ -849,7 +849,7 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
smp_mb();

/* Space might have just been freed - check again */
if (temac_check_tx_bd_space(lp, num_frag))
if (temac_check_tx_bd_space(lp, num_frag + 1))
return NETDEV_TX_BUSY;

netif_wake_queue(ndev);
Expand Down

0 comments on commit cfe403f

Please sign in to comment.