From: Joshua Crofts <crofts@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: lee@kernel.org, maz@kernel.org, andy@kernel.org,
jic23@kernel.org, dmitry.torokhov@gmail.com,
linux-input@vger.kernel.org, mfd@lists.linux.dev,
linux-iio@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH v4 2/4] iio: adc: mxs-lradc: Fix trigger use-after-free on removal
Date: Wed, 18 Nov 2026 09:56:35 +0100 [thread overview]
Message-ID: <20261118095635.00005533@kernel.org> (raw)
In-Reply-To: <20261116224803.61154-2-festevam@gmail.com>
On Mon, 16 Nov 2026 19:48:01 -0300
Fabio Estevam <festevam@gmail.com> wrote:
> The LRADC trigger is devm-allocated against the IIO device, but it is
> manually unregistered after iio_device_unregister(). The latter deletes
> the IIO device and releases its managed resources, freeing the trigger
> before mxs_lradc_adc_trigger_remove() accesses it.
>
> Since commit 699fb50d9903 ("drivers: base: Free devm resources when
> unregistering a device"), device_del() releases managed resources.
> Consequently, iio_device_unregister() drops the trigger's allocation
> reference before the driver unregisters it.
>
> On an i.MX28 EVK with KASAN enabled, unbinding the LRADC parent with:
>
> echo 80050000.lradc > /sys/bus/platform/drivers/mxs-lradc/unbind
>
> reports a slab-use-after-free in device_release_driver_internal().
>
> Allocate the managed trigger against the platform device instead. This
> matches the trigger device's parent and keeps the allocation alive until
> the platform driver's remove callback has unregistered the trigger.
>
> Cc: stable@vger.kernel.org
> Fixes: 699fb50d9903 ("drivers: base: Free devm resources when unregistering a device")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
Reviewed-by: Joshua Crofts <crofts@kernel.org>
--
Kind regards,
Joshua Crofts
next prev parent reply other threads:[~2026-11-18 8:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261116224803.61154-1-festevam@gmail.com>
2026-11-16 22:48 ` [PATCH v4 2/4] iio: adc: mxs-lradc: Fix trigger use-after-free on removal Fabio Estevam
2026-11-18 8:56 ` Joshua Crofts [this message]
2026-11-16 22:48 ` [PATCH v4 3/4] mfd: mxs-lradc: Pass parent IRQs to child drivers Fabio Estevam
2026-11-16 22:51 ` Fabio Estevam
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=20261118095635.00005533@kernel.org \
--to=crofts@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=maz@kernel.org \
--cc=mfd@lists.linux.dev \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox