mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: davem@davemloft.net, linux-can@vger.kernel.org,
	 linux-kernel@vger.kernel.org, mailhol@kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] can: flexcan: Fix OF node reference leak in flexcan_setup_stop_mode_gpr()
Date: Thu, 17 Sep 2026 12:01:11 +0200	[thread overview]
Message-ID: <20260917-clever-lumpy-stallion-df086f-mkl@pengutronix.de> (raw)
In-Reply-To: <20260917095302.2145506-1-vulab@iscas.ac.cn>

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On 17.09.2026 09:53:02, Wentao Liang wrote:
> of_find_node_by_phandle() takes a reference on the GPR node and the
> error path releases it through out_put_node.  The success path returns
> before reaching that label, so the reference is leaked every time the
> stop mode is set up successfully, and the node can never be freed.
>
> Release the node reference before returning.
>
> Fixes: 13dfb3fa4943 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")

A merge commit probably has not introduced this problem...

Marc

> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/net/can/flexcan/flexcan-core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index f5d22c61503f..68699d674fc3 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -1986,6 +1986,7 @@ static int flexcan_setup_stop_mode_gpr(struct platform_device *pdev)
>  		"gpr %s req_gpr=0x02%x req_bit=%u\n",
>  		gpr_np->full_name, priv->stm.req_gpr, priv->stm.req_bit);
>
> +	of_node_put(gpr_np);
>  	return 0;
>
>  out_put_node:
> --
> 2.34.1
>
>

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2026-09-17 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  9:53 Wentao Liang
2026-09-17 10:01 ` Marc Kleine-Budde [this message]

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=20260917-clever-lumpy-stallion-df086f-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    /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®