]> git.baikalelectronics.ru Git - kernel.git/commit
spi: fsl-dspi: fix use-after-free in remove path
authorSascha Hauer <s.hauer@pengutronix.de>
Wed, 23 Sep 2020 13:10:26 +0000 (15:10 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 23 Sep 2020 16:31:14 +0000 (17:31 +0100)
commit81313147de75ef432f5fd14038890cadefc49ebd
treed4070e5983f6f0416b7cc280bc9f44a405e360e9
parente809700eaf243ffaeb6bb9f7e517ad03c8a9c12d
spi: fsl-dspi: fix use-after-free in remove path

spi_unregister_controller() not only unregisters the controller, but
also frees the controller. This will free the driver data with it, so
we must not access it later dspi_remove().

Solve this by allocating the driver data separately from the SPI
controller.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20200923131026.20707-1-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c