Revert "spi: fix use-after-free of the add_lock mutex"
This reverts commit 54c2c96eaf which is
commit 6c53b45c71b4920b5e62f0ea8079a1da382b9434 upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: Icce07d26ecdbeb799b479babd47730046b402902
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
da1a77953e
commit
a1434939a5
1 changed files with 7 additions and 7 deletions
|
|
@ -2674,6 +2674,13 @@ void spi_unregister_controller(struct spi_controller *ctlr)
|
|||
|
||||
device_del(&ctlr->dev);
|
||||
|
||||
/* Release the last reference on the controller if its driver
|
||||
* has not yet been converted to devm_spi_alloc_master/slave().
|
||||
*/
|
||||
if (!devres_find(ctlr->dev.parent, devm_spi_release_controller,
|
||||
devm_spi_match_controller, ctlr))
|
||||
put_device(&ctlr->dev);
|
||||
|
||||
/* free bus id */
|
||||
mutex_lock(&board_lock);
|
||||
if (found == ctlr)
|
||||
|
|
@ -2682,13 +2689,6 @@ void spi_unregister_controller(struct spi_controller *ctlr)
|
|||
|
||||
if (IS_ENABLED(CONFIG_SPI_DYNAMIC))
|
||||
mutex_unlock(&ctlr->add_lock);
|
||||
|
||||
/* Release the last reference on the controller if its driver
|
||||
* has not yet been converted to devm_spi_alloc_master/slave().
|
||||
*/
|
||||
if (!devres_find(ctlr->dev.parent, devm_spi_release_controller,
|
||||
devm_spi_match_controller, ctlr))
|
||||
put_device(&ctlr->dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(spi_unregister_controller);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue