net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
Subsystems (4)
PATCH v2 1/1 net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
Add check for the return value of rcar_gen4_ptp_alloc() to prevent potential null pointer dereference.
---
Changes in v2:
- Add a blank line to make the grouping similar to the style of other error checks in probe. Thanks, Niklas!
--- drivers/net/ethernet/renesas/rtsn.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/renesas/rtsn.c +5 -0
@@ -1259,7 +1259,12 @@ static int rtsn_probe(struct platform_device *pdev) priv =netdev_priv (ndev); priv->pdev = pdev; priv->ndev = ndev; + priv->ptp_priv =rcar_gen4_ptp_alloc (pdev); +if (!priv->ptp_priv) { + ret = -ENOMEM ; + goto error_free; + }spin_lock_init (&priv->lock);platform_set_drvdata (pdev, priv);
Signature · 1 line
2.25.1
Hi Haoxiang,
Thanks for your work.
Quoted 6 lines · Haoxiang Li
Add check for the return value of
rcar_gen4_ptp_alloc()to prevent potential null pointer dereference.Fixes b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")Signed-off-by Haoxiang Li <[email protected]>
Quoted 28 lines
---
Changes in v2:
- Add a blank line to make the grouping similar to the style of other error checks in probe. Thanks, Niklas!--- drivers/net/ethernet/renesas/rtsn.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/net/ethernet/renesas/rtsn.c +5
-0@@ -1259,7 +1259,12 @@ static int rtsn_probe(struct platform_device *pdev) priv =netdev_priv (ndev); priv->pdev = pdev; priv->ndev = ndev; + priv->ptp_priv =rcar_gen4_ptp_alloc (pdev); +if (!priv->ptp_priv) { + ret = -ENOMEM ; + goto error_free; + }spin_lock_init (&priv->lock);platform_set_drvdata (pdev, priv);Signature · 1 line
2.25.1
Signature · 2 lines
Kind Regards, Niklas Söderlund
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 3 Jul 2025 18:01:09 +0800 you wrote:
Add check for the return value of
rcar_gen4_ptp_alloc()to prevent potential null pointer dereference.Fixes b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")Signed-off-by Haoxiang Li <[email protected]>[...]
Here is the summary with links:
- [v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
https://git.kernel.org/netdev/net/c/95a234f6affb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html