[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250829121051.2031832-1-c-vankar@ti.com>
Date: Fri, 29 Aug 2025 17:40:51 +0530
From: Chintan Vankar <c-vankar@...com>
To: Michael Walle <mwalle@...nel.org>, Simon Horman <horms@...nel.org>,
Roger
Quadros <rogerq@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski
<kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
"David S. Miller"
<davem@...emloft.net>,
Andrew Lunn <andrew+netdev@...n.ch>
CC: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>, <nm@...com>,
<s-vadapalli@...com>, <danishanwar@...com>,
Chintan Vankar <c-vankar@...com>
Subject: [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev
From: Nishanth Menon <nm@...com>
In the TX completion packet stage of TI SoCs with CPSW2G instance, which
has single external ethernet port, ndev is accessed without being
initialized if no TX packets have been processed. It results into null
pointer dereference, causing kernel to crash. Fix this by having a check
on the number of TX packets which have been processed.
Fixes: 9a369ae3d143 ("net: ethernet: ti: am65-cpsw: remove am65_cpsw_nuss_tx_compl_packets_2g()")
Signed-off-by: Nishanth Menon <nm@...com>
Signed-off-by: Chintan Vankar <c-vankar@...com>
---
Hello All,
This patch is based on the commit '5189446ba995' of
origin/main branch of Linux-net repository.
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index ecd6ecac87bb..8b2364f5f731 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -1522,7 +1522,7 @@ static int am65_cpsw_nuss_tx_compl_packets(struct am65_cpsw_common *common,
}
}
- if (single_port) {
+ if (single_port && num_tx) {
netif_txq = netdev_get_tx_queue(ndev, chn);
netdev_tx_completed_queue(netif_txq, num_tx, total_bytes);
am65_cpsw_nuss_tx_wake(tx_chn, ndev, netif_txq);
--
2.34.1
Powered by blists - more mailing lists