[SRU focal/linux-hwe-5.8 1/4] net: ll_temac: Fix TX BD buffer overwrite
Thadeu Lima de Souza Cascardo
cascardo at canonical.com
Thu Sep 23 23:50:58 UTC 2021
From: Esben Haabendal <esben at geanix.com>
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 at vger.kernel.org # v5.4+
Signed-off-by: Esben Haabendal <esben at geanix.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit c364df2489b8ef2f5e3159b1dff1ff1fdb16040d)
CVE-2021-38207
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 030185301014..f8992e530549 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -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);
--
2.30.2
More information about the kernel-team
mailing list