From: Jonathan Cameron <jic23@kernel.org>
To: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: lars@metafoo.de, linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: inkern: call iio_device_put() only on mapped devices
Date: Sun, 8 Dec 2024 16:49:44 +0000 [thread overview]
Message-ID: <20241208164944.6fcee6c8@jic23-huawei> (raw)
In-Reply-To: <20241204111342.1246706-1-joe@pf.is.s.u-tokyo.ac.jp>
On Wed, 4 Dec 2024 20:13:42 +0900
Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> wrote:
> In the error path of iio_channel_get_all(), iio_device_put() is called
> on all IIO devices, which can cause a refcount imbalance. Fix this error
> by calling iio_device_put() only on IIO devices whose refcounts were
> previously incremented by iio_device_get().
>
> Fixes: 314be14bb893 ("iio: Rename _st_ functions to loose the bit that meant the staging version.")
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
> ---
> drivers/iio/inkern.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 136b225b6bc8..9050a59129e6 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -500,7 +500,7 @@ struct iio_channel *iio_channel_get_all(struct device *dev)
> return_ptr(chans);
>
> error_free_chans:
> - for (i = 0; i < nummaps; i++)
> + for (i = 0; i < mapind; i++)
> iio_device_put(chans[i].indio_dev);
> return ERR_PTR(ret);
> }
prev parent reply other threads:[~2024-12-08 16:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 11:13 [PATCH] iio: inkern: call iio_device_put() only on mapped devices Joe Hattori
2024-12-08 16:49 ` 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=20241208164944.6fcee6c8@jic23-huawei \
--to=jic23@kernel.org \
--cc=joe@pf.is.s.u-tokyo.ac.jp \
--cc=lars@metafoo.de \
--cc=linux-iio@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