* [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
@ 2025-07-03 10:01 Haoxiang Li
2025-07-03 13:16 ` Niklas Söderlund
2025-07-08 15:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-07-03 10:01 UTC (permalink / raw)
To: niklas.soderlund, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran
Cc: netdev, linux-renesas-soc, linux-kernel, Haoxiang Li, stable
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")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
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(+)
diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
index 6b3f7fca8d15..05c4b6c8c9c3 100644
--- a/drivers/net/ethernet/renesas/rtsn.c
+++ b/drivers/net/ethernet/renesas/rtsn.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
2025-07-03 10:01 [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe() Haoxiang Li
@ 2025-07-03 13:16 ` Niklas Söderlund
2025-07-08 15:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Niklas Söderlund @ 2025-07-03 13:16 UTC (permalink / raw)
To: Haoxiang Li
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, richardcochran,
netdev, linux-renesas-soc, linux-kernel, stable
Hi Haoxiang,
Thanks for your work.
On 2025-07-03 18:01:09 +0800, Haoxiang Li 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")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> 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(+)
>
> diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
> index 6b3f7fca8d15..05c4b6c8c9c3 100644
> --- a/drivers/net/ethernet/renesas/rtsn.c
> +++ b/drivers/net/ethernet/renesas/rtsn.c
> @@ -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);
> --
> 2.25.1
>
--
Kind Regards,
Niklas Söderlund
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
2025-07-03 10:01 [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe() Haoxiang Li
2025-07-03 13:16 ` Niklas Söderlund
@ 2025-07-08 15:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-08 15:40 UTC (permalink / raw)
To: Haoxiang Li
Cc: niklas.soderlund, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, netdev, linux-renesas-soc, linux-kernel, stable
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
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")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
>
> [...]
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!
--
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-07-08 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 10:01 [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe() Haoxiang Li
2025-07-03 13:16 ` Niklas Söderlund
2025-07-08 15:40 ` 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).