Re: [PATCH] iio: accel: kxsd9: Fix potential use-after-free on removal

From: Joshua Crofts

Date: Sat Oct 31 2026 - 12:06:09 EST


On Sat, 31 Oct 2026 21:05:38 +0800
Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx> wrote:

> Unregistering an IIO device with an active triggered buffer detaches its
> poll function. Freeing the poll function first can therefore make
> iio_device_unregister() access freed memory.
>
> Unregister the device before cleaning up the triggered buffer.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: 0427a106a98a ("iio: accel: kxsd9: Add triggered buffer handling")
> Assisted-by: OpenAI:gpt-6-astra

Drop this tag, it has been deprecated.

Otherwise LGTM.

Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>

--
Kind regards,
Joshua Crofts