* [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev
@ 2025-08-29 12:10 Chintan Vankar
2025-09-01 13:22 ` Simon Horman
2025-09-02 13:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Chintan Vankar @ 2025-08-29 12:10 UTC (permalink / raw)
To: Michael Walle, Simon Horman, Roger Quadros, Paolo Abeni,
Jakub Kicinski, Eric Dumazet, David S. Miller, Andrew Lunn
Cc: linux-kernel, netdev, nm, s-vadapalli, danishanwar,
Chintan Vankar
From: Nishanth Menon <nm@ti.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@ti.com>
Signed-off-by: Chintan Vankar <c-vankar@ti.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev
2025-08-29 12:10 [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev Chintan Vankar
@ 2025-09-01 13:22 ` Simon Horman
2025-09-02 13:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-09-01 13:22 UTC (permalink / raw)
To: Chintan Vankar
Cc: Michael Walle, Roger Quadros, Paolo Abeni, Jakub Kicinski,
Eric Dumazet, David S. Miller, Andrew Lunn, linux-kernel, netdev,
nm, s-vadapalli, danishanwar
On Fri, Aug 29, 2025 at 05:40:51PM +0530, Chintan Vankar wrote:
> From: Nishanth Menon <nm@ti.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@ti.com>
> Signed-off-by: Chintan Vankar <c-vankar@ti.com>
Thanks,
I see that prior to the cited commit, the code now
in the condition updated by this patch was executed
in the loop that now precedes the conditional. And in
the flow before the cited patch ndev was always set
in the loop before the code in question runs.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev
2025-08-29 12:10 [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev Chintan Vankar
2025-09-01 13:22 ` Simon Horman
@ 2025-09-02 13:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-02 13:00 UTC (permalink / raw)
To: Chintan Vankar
Cc: mwalle, horms, rogerq, pabeni, kuba, edumazet, davem,
andrew+netdev, linux-kernel, netdev, nm, s-vadapalli, danishanwar
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Fri, 29 Aug 2025 17:40:51 +0530 you wrote:
> From: Nishanth Menon <nm@ti.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.
>
> [...]
Here is the summary with links:
- [net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev
https://git.kernel.org/netdev/net/c/a6099f263e1f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-02 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 12:10 [PATCH net] net: ethernet: ti: am65-cpsw-nuss: Fix null pointer dereference for ndev Chintan Vankar
2025-09-01 13:22 ` Simon Horman
2025-09-02 13:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).