Re: [PATCH spi] spi: spi-fsl-lpspi: fix teardown order issue (UAF)

From: Mark Brown

Date: Tue Mar 24 2026 - 11:47:13 EST


On Tue, Mar 24, 2026 at 04:22:30PM +0100, Marc Kleine-Budde wrote:
> On 24.03.2026 11:05:11, Frank Li wrote:
> > On Thu, Mar 19, 2026 at 07:38:12PM +0100, Marc Kleine-Budde wrote:

> > > fsl_lpspi_probe() and add the corresponding spi_unregister_controller() in
> > > fsl_lpspi_remove().

> > Feel like it is not correct's fix. devm_spi_register_controller() is quite
> > common, other SPI controller should have similar problem.

...

> The patch unregisters the SPI controller prior the tearing down thee DMA
> support.

> Another options would be to push everything in the fsl_lpspi_remove() to
> devm, too.

Right, this is the thing with using devm_ for the controller - either
the driver needs to fully use devm_ or it can't use it for registering
the controller itself since you get unwind ordering issues.

Attachment: signature.asc
Description: PGP signature