mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: zhaofeng2 <zhaofeng2@cmss.chinamobile.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] soc: ti: knav_dma: Fix device node leak in of_channel_match_helper()
Date: Fri, 20 Nov 2026 10:06:02 -0600	[thread overview]
Message-ID: <20261120160602.ep424lfd7ju6goqj@rejoice> (raw)
In-Reply-To: <20261110101131.443-1-zhaofeng2@cmss.chinamobile.com>

On 18:11-20261110, zhaofeng2 wrote:
> From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
> 
> of_channel_match_helper() resolves the "ti,navigator-dmas" phandle
> with of_parse_phandle_with_fixed_args() to obtain the channel number,
> which takes a reference on the dma device node in args.np, but the
> reference is never dropped after the channel number has been read
> from args.args[0], so the dma node is leaked on every channel open.
> 
> Drop the reference once the channel number has been retrieved.  The
> phandle stored in dma_node is deliberately kept, as its ->name string
> is handed out through *dma_instance and compared against later in
> knav_dma_open_channel().

But, do we need to take care of dma_node around error paths?

> 
> Fixes: 88139ed03058 ("soc: ti: add Keystone Navigator DMA support")
> Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
> ---
>  drivers/soc/ti/knav_dma.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c
> --- a/drivers/soc/ti/knav_dma.c
> +++ b/drivers/soc/ti/knav_dma.c
> @@ -387,6 +387,8 @@
>  		return -ENODEV;
>  	}
>  
> +	of_node_put(args.np);
> +


>  	return args.args[0];
>  }
>  
> 
> 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource

  reply	other threads:[~2026-11-20 16:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 10:11 zhaofeng2
2026-11-20 16:06 ` Nishanth Menon [this message]
2026-11-23  6:50 ` [PATCH v2] soc: ti: knav_dma: fix " zhaofeng2
2026-12-03 16:08   ` Andrew Davis

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=20261120160602.ep424lfd7ju6goqj@rejoice \
    --to=nm@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=zhaofeng2@cmss.chinamobile.com \
    /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®