The call to spi_master_put() in amd_spi_remove() is redundant and may causes user after free since the master have been freed by spi_unregister_master(), so remove it. Fixes: bbb336f39efc ("spi: spi-amd: Add AMD SPI controller driver support") Reported-by: Hulk Robot <hulkci@xxxxxxxxxx> Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx> --- drivers/spi/spi-amd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index c7cfc3dc20b1..e5e767ba5823 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -304,7 +304,6 @@ static int amd_spi_remove(struct platform_device *pdev) struct amd_spi *amd_spi = platform_get_drvdata(pdev); spi_unregister_master(amd_spi->master); - spi_master_put(amd_spi->master); platform_set_drvdata(pdev, NULL); return 0;