Yang Yingliang 43cc5a0afe
spi: Fix simplification of devm_spi_register_controller
This reverts commit 59ebbe40fb51 ("spi: simplify
devm_spi_register_controller").

If devm_add_action() fails in devm_add_action_or_reset(),
devm_spi_unregister() will be called, it decreases the
refcount of 'ctlr->dev' to 0, then it will cause uaf in
the drivers that calling spi_put_controller() in error path.

Fixes: 59ebbe40fb51 ("spi: simplify devm_spi_register_controller")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20220712135504.1055688-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-13 13:49:02 +01:00
..
2022-01-04 14:59:40 +00:00
2022-01-07 13:36:37 +00:00
2021-07-20 13:34:05 +01:00
2021-12-23 13:38:38 +00:00
2022-05-25 16:55:16 -07:00
2021-08-26 12:09:38 +01:00
2022-03-15 12:03:58 +00:00
2022-04-19 13:13:48 +01:00