Skip to content

Commit

Permalink
spi: microchip-core: fix UAF in mchp_corespi_remove()
Browse files Browse the repository at this point in the history
When using devm_spi_register_master(), the unregister function will
be called in devres_release_all() which is called after ->remove(),
so remove spi_unregister_master() andspi_master_put().

Fixes: 9ac8d17 ("spi: add support for microchip fpga spi controllers")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20220713025657.3524506-2-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Yang Yingliang authored and Mark Brown committed Jul 13, 2022
1 parent cdb0cc9 commit e82c6d6
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/spi/spi-microchip-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,6 @@ static int mchp_corespi_remove(struct platform_device *pdev)
struct mchp_corespi *spi = spi_master_get_devdata(master);

mchp_corespi_disable_ints(spi);
spi_unregister_master(master);
spi_master_put(master);
clk_disable_unprepare(spi->clk);
mchp_corespi_disable(spi);

Expand Down

0 comments on commit e82c6d6

Please sign in to comment.