* [PATCH net] net: sxgbe: fix null pointer dereference in probe error path
@ 2026-07-17 9:14 Chenguang Zhao
2026-07-17 16:11 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Chenguang Zhao @ 2026-07-17 9:14 UTC (permalink / raw)
To: bh74.an, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, chenguang.zhao, Chenguang Zhao
From: Chenguang Zhao <zhaochenguang@kylinos.cn>
The platform drvdata is not set until all IRQs have been mapped, so the
local net_device pointer is NULL when IRQ mapping fails. Remove the device
allocated by sxgbe_drv_probe() through priv instead.
Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
---
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index 2eccc7617507..e4701b29e1a0 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -82,7 +82,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
void __iomem *addr;
struct sxgbe_priv_data *priv = NULL;
struct sxgbe_plat_data *plat_dat = NULL;
- struct net_device *ndev = platform_get_drvdata(pdev);
struct device_node *node = dev->of_node;
/* Get memory resource */
@@ -158,7 +157,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
irq_dispose_mapping(priv->txq[i]->irq_no);
irq_dispose_mapping(priv->irq);
err_drv_remove:
- sxgbe_drv_remove(ndev);
+ sxgbe_drv_remove(priv->dev);
err_out:
return -ENODEV;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] net: sxgbe: fix null pointer dereference in probe error path
2026-07-17 9:14 [PATCH net] net: sxgbe: fix null pointer dereference in probe error path Chenguang Zhao
@ 2026-07-17 16:11 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2026-07-17 16:11 UTC (permalink / raw)
To: Chenguang Zhao
Cc: bh74.an, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
Chenguang Zhao
On Fri, Jul 17, 2026 at 05:14:23PM +0800, Chenguang Zhao wrote:
> From: Chenguang Zhao <zhaochenguang@kylinos.cn>
>
> The platform drvdata is not set until all IRQs have been mapped, so the
> local net_device pointer is NULL when IRQ mapping fails. Remove the device
> allocated by sxgbe_drv_probe() through priv instead.
>
> Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
> Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-17 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 9:14 [PATCH net] net: sxgbe: fix null pointer dereference in probe error path Chenguang Zhao
2026-07-17 16:11 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox