aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-rspi.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-08-31 07:42:56 -0400
committerMark Brown <broonie@linaro.org>2013-08-31 07:58:53 -0400
commit9d3405dbbbd8418a095301d495da65bc3bc5f806 (patch)
tree9ff232800a36890202d8f87be7a6cc4b8ddabe55 /drivers/spi/spi-rspi.c
parent8d4d08ce8319ae26227c4dd558405963c14c2037 (diff)
spi: rspi: Add spi_master_get() call to prevent use after free
In rspi_remove(), current code dereferences rspi after spi_unregister_master(), thus add an extra spi_master_get() call is necessary to prevent use after free. Current code already has an extra spi_master_put() call in rspi_remove(), so this patch just adds a spi_master_get() call rather than a spi_master_get() with spi_master_put() calls. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-rspi.c')
-rw-r--r--drivers/spi/spi-rspi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 00c32320dce8..49ae72a93087 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -726,7 +726,7 @@ static void rspi_release_dma(struct rspi_data *rspi)
726 726
727static int rspi_remove(struct platform_device *pdev) 727static int rspi_remove(struct platform_device *pdev)
728{ 728{
729 struct rspi_data *rspi = platform_get_drvdata(pdev); 729 struct rspi_data *rspi = spi_master_get(platform_get_drvdata(pdev));
730 730
731 spi_unregister_master(rspi->master); 731 spi_unregister_master(rspi->master);
732 rspi_release_dma(rspi); 732 rspi_release_dma(rspi);