From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] net: ethernet: rtsn: Fix a null pointer dereference in rtsn_probe()
Date: Thu, 3 Jul 2025 15:16:21 +0200 [thread overview]
Message-ID: <20250703131621.GB3900914@ragnatech.se> (raw)
In-Reply-To: <20250703100109.2541018-1-haoxiang_li2024@163.com>
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
next prev parent reply other threads:[~2025-07-03 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 10:01 Haoxiang Li
2025-07-03 13:16 ` Niklas Söderlund [this message]
2025-07-08 15:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250703131621.GB3900914@ragnatech.se \
--to=niklas.soderlund@ragnatech.se \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haoxiang_li2024@163.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®