mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joshua Crofts <joshua.crofts1@gmail.com>
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: Linus Walleij <linusw@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dingisoul <dingiso.kernel@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: gyro: mpu3050: add missing trigger cleanup on remove()
Date: Mon, 19 Oct 2026 14:09:05 +0200	[thread overview]
Message-ID: <20261019140905.00000094@gmail.com> (raw)
In-Reply-To: <atX1alPtnByIsGFr@nsa>

On Mon, 19 Oct 2026 11:54:41 +0100
Nuno Sá <nuno.sa@analog.com> wrote:

> On Sat, Oct 17, 2026 at 07:19:21AM +0200, Joshua Crofts wrote:
> > The mpu3050_trigger_probe() registers a trigger but
> > mpu3050_common_remove() and error paths in mpu3050_common_probe() forget
> > to clean it up, causing a use-after-free bug.
> > 
> > Add the missing calls to the iio_trigger_unregister() function.
> > 
> > Reported-by: Dingisoul <dingiso.kernel@gmail.com>
> > Closes: https://lore.kernel.org/all/20261010203601.1686148-1-dingiso.kernel@gmail.com/
> > Fixes: 3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
> > ---
> >  drivers/iio/gyro/mpu3050-core.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
> > index 879caf3b729c..9e747836df3e 100644
> > --- a/drivers/iio/gyro/mpu3050-core.c
> > +++ b/drivers/iio/gyro/mpu3050-core.c
> > @@ -1262,7 +1262,9 @@ int mpu3050_common_probe(struct device *dev,
> >  	pm_runtime_get_sync(dev);
> >  	pm_runtime_put_noidle(dev);
> >  	pm_runtime_disable(dev);
> > -	if (irq)
> > +	if (mpu3050->trig)
> > +		iio_trigger_unregister(mpu3050->trig);  
> 
> Yeah, I think sashiko is right... I think we can just reuse the if
> (mpu3050->irq) condition for unregistering  but then this patch depends
> on the previous one. And such dependencies can be set for stable so
> don't think it's an issue.
> 
> I already pointed it out and Jonathan seems to have said the same. If
> you do have the time, converting the whole thing to devm would be nice 
> - could be patch 3 :)

Bad time to be lazy :P I'll have a look.

-- 
Kind regards,
Joshua Crofts

  reply	other threads:[~2026-10-19 12:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17  5:19 [PATCH v3 0/2] iio: gyro: mpu3050: add missing trigger cleanup Joshua Crofts
2026-10-17  5:19 ` [PATCH v3 1/2] iio: gyro: mpu3050: fail probe() on trigger registration failure Joshua Crofts
2026-10-17  5:19 ` [PATCH v3 2/2] iio: gyro: mpu3050: add missing trigger cleanup on remove() Joshua Crofts
2026-10-19 10:54   ` Nuno Sá
2026-10-19 12:09     ` Joshua Crofts [this message]
2026-10-17 18:21 ` [PATCH v3 0/2] iio: gyro: mpu3050: add missing trigger cleanup Jonathan Cameron
2026-10-17 20:20   ` Joshua Crofts
2026-10-19  8:51   ` Andy Shevchenko

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=20261019140905.00000094@gmail.com \
    --to=joshua.crofts1@gmail.com \
    --cc=andy@kernel.org \
    --cc=dingiso.kernel@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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®