mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client
Date: Fri, 3 Jun 2022 16:29:34 +0100	[thread overview]
Message-ID: <20220603162934.7e6b0783@jic23-huawei> (raw)
In-Reply-To: <20220524074517.45268-1-linmq006@gmail.com>

On Tue, 24 May 2022 11:45:17 +0400
Miaoqian Lin <linmq006@gmail.com> wrote:

> of_parse_phandle() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() to avoid refcount leak.
> 
> Fixes: ef04070692a2 ("iio: adc: adi-axi-adc: add support for AXI ADC IP core")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Looks 'obviously correct to me' so applied to the fixes togreg branch of iio.git
and marked for stable.

Great if anyone more familiar with this driver than me has a chance
to take a quick look though.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/adi-axi-adc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
> index a73e3c2d212f..a9e655e69eaa 100644
> --- a/drivers/iio/adc/adi-axi-adc.c
> +++ b/drivers/iio/adc/adi-axi-adc.c
> @@ -322,16 +322,19 @@ static struct adi_axi_adc_client *adi_axi_adc_attach_client(struct device *dev)
>  
>  		if (!try_module_get(cl->dev->driver->owner)) {
>  			mutex_unlock(&registered_clients_lock);
> +			of_node_put(cln);
>  			return ERR_PTR(-ENODEV);
>  		}
>  
>  		get_device(cl->dev);
>  		cl->info = info;
>  		mutex_unlock(&registered_clients_lock);
> +		of_node_put(cln);
>  		return cl;
>  	}
>  
>  	mutex_unlock(&registered_clients_lock);
> +	of_node_put(cln);
>  
>  	return ERR_PTR(-EPROBE_DEFER);
>  }


      reply	other threads:[~2022-06-03 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  7:45 Miaoqian Lin
2022-06-03 15:29 ` Jonathan Cameron [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=20220603162934.7e6b0783@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=lars@metafoo.de \
    --cc=linmq006@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@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®