net: sxgbe: fix null pointer dereference in probe error path
Subsystems (3)
PATCH 1/1 net: sxgbe: fix null pointer dereference in probe error path
From: Chenguang Zhao <[email protected]>
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.
--- drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c +1 -2
@@ -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 ; }
Signature · 1 line
2.25.1
Quoted 8 lines · Chenguang Zhao
From: Chenguang Zhao <[email protected]>
The platform drvdata is not set until all IRQs have been mapped, so the local
net_devicepointer is NULL when IRQ mapping fails. Remove the device allocated bysxgbe_drv_probe()through priv instead.Fixes 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")Signed-off-by Chenguang Zhao <[email protected]>
Andrew
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 17 Jul 2026 17:14:23 +0800 you wrote:
From: Chenguang Zhao <[email protected]>
The platform drvdata is not set until all IRQs have been mapped, so the local
net_devicepointer is NULL when IRQ mapping fails. Remove the device allocated bysxgbe_drv_probe()through priv instead.Fixes 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")Signed-off-by Chenguang Zhao <[email protected]>[...]
Here is the summary with links:
- [net] net: sxgbe: fix null pointer dereference in probe error path
https://git.kernel.org/netdev/net-next/c/1df10cef2d1e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html