diff options
| author | Felix Gu <ustc.gu@gmail.com> | 2026-03-10 02:01:34 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-19 16:08:15 +0100 |
| commit | b6051f2bdd4bd3dde85b68558edd3a6843489221 (patch) | |
| tree | f0756bd076b2650f670e7ae2776b3921d9459133 | |
| parent | 0a83d6c9e149a176340190fa9cbadf2266db4c9a (diff) | |
spi: rockchip-sfc: Fix double-free in remove() callback
[ Upstream commit 111e2863372c322e836e0c896f6dd9cf4ee08c71 ]
The driver uses devm_spi_register_controller() for registration, which
automatically unregisters the controller via devm cleanup when the
device is removed. The manual call to spi_unregister_controller() in
the remove() callback can lead to a double-free.
And to make sure controller is unregistered before DMA buffer is
unmapped, switch to use spi_register_controller() in probe().
Fixes: 8011709906d0 ("spi: rockchip-sfc: Support pm ops")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260310-sfc-v2-1-67fab04b097f@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/spi/spi-rockchip-sfc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-rockchip-sfc.c b/drivers/spi/spi-rockchip-sfc.c index b3c2b03b1153..8acf95563697 100644 --- a/drivers/spi/spi-rockchip-sfc.c +++ b/drivers/spi/spi-rockchip-sfc.c @@ -712,7 +712,7 @@ static int rockchip_sfc_probe(struct platform_device *pdev) } } - ret = devm_spi_register_controller(dev, host); + ret = spi_register_controller(host); if (ret) goto err_register; |
