Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6c0ab11 authored by Esben Haabendal's avatar Esben Haabendal Committed by Greg Kroah-Hartman
Browse files

net: ll_temac: Fix TX BD buffer overwrite



commit c364df2489b8ef2f5e3159b1dff1ff1fdb16040d 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: 84823ff80f74 ("net: ll_temac: Fix race condition causing TX hang")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: default avatarEsben Haabendal <esben@geanix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d120ab4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -846,7 +846,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);