Skip to content

Commit

Permalink
spi: rspi: Add spi_master_get() call to prevent use after free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Aug 31, 2013
1 parent 8d4d08c commit 9d3405d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-rspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ static void rspi_release_dma(struct rspi_data *rspi)

static int rspi_remove(struct platform_device *pdev)
{
struct rspi_data *rspi = platform_get_drvdata(pdev);
struct rspi_data *rspi = spi_master_get(platform_get_drvdata(pdev));

spi_unregister_master(rspi->master);
rspi_release_dma(rspi);
Expand Down

0 comments on commit 9d3405d

Please sign in to comment.