From: "Nuno Sá" <nuno.sa@analog.com>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: Dingisoul <dingiso.kernel@gmail.com>,
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,
stable@vger.kernel.org
Subject: Re: [PATCH v2] iio: gyro: mpu3050: add missing trigger cleanup on remove
Date: Fri, 16 Oct 2026 09:39:51 +0100 [thread overview]
Message-ID: <atHinTYMtjsY45wY@nsa> (raw)
In-Reply-To: <20261015221818.09527ff6@systembl0wer>
On Thu, Oct 15, 2026 at 10:18:18PM +0200, Joshua Crofts wrote:
> On Thu, 15 Oct 2026 21:58:35 +0200
> Joshua Crofts <joshua.crofts1@gmail.com> wrote:
>
> > The mpu3050_trigger_probe() function 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 iio_trigger_unregister() function. Additionally, change
> > the mpu3050_trigger_probe() function to assign trig only after it is
> > registered successfully to prevent a null pointer dereference using a
> > local struct iio_trigger.
> >
> > 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>
> > ---
>
> Dingisoul, any chance you can test this?
>
> Q to others: better to leave the driver running in this weird
> polling mode as it is now or return on trigger register failure
> as Nuno suggests?
Don't think it makes sense to continue if the idea is to have trigger
but something failed when dealing with it. At the very least we should
then drop the memory we allocated for it.
- Nuno Sá
>
> Thanks.
>
> --
> Kind regards,
> Joshua Crofts
prev parent reply other threads:[~2026-10-16 8:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 19:58 [PATCH v2] iio: gyro: mpu3050: add missing trigger cleanup on remove Joshua Crofts
2026-10-15 20:18 ` Joshua Crofts
2026-10-15 20:35 ` Dingisoul
2026-10-15 20:41 ` Joshua Crofts
2026-10-16 8:39 ` Nuno Sá [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=atHinTYMtjsY45wY@nsa \
--to=nuno.sa@analog.com \
--cc=andy@kernel.org \
--cc=dingiso.kernel@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.