]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: imx: fix use-after-free on unbind
authorJohan Hovold <johan@kernel.org>
Tue, 24 Mar 2026 08:23:22 +0000 (09:23 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 24 Mar 2026 14:25:47 +0000 (14:25 +0000)
commit1c78c2002380a1fe31bfb01a3d5f29809e55a096
tree2bd86325b18a91259269a19a87fd6a57582d2fd4
parentc369299895a591d96745d6492d4888259b004a9e
spi: imx: fix use-after-free on unbind

The SPI subsystem frees the controller and any subsystem allocated
driver data as part of deregistration (unless the allocation is device
managed).

Take another reference before deregistering the controller so that the
driver data is not freed until the driver is done with it.

Fixes: 307c897db762 ("spi: spi-imx: replace struct spi_imx_data::bitbang by pointer to struct spi_controller")
Cc: stable@vger.kernel.org # 5.19
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260324082326.901043-2-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c