Skip to content

Commit

Permalink
moxart: fix potential use-after-free on remove path
Browse files Browse the repository at this point in the history
commit bd2db32 upstream.

It was reported that the mmc host structure could be accessed after it
was freed in moxart_remove(), so fix this by saving the base register of
the device and using it instead of the pointer dereference.

Cc: Ulf Hansson <[email protected]>
Cc: Xiyu Yang <[email protected]>
Cc: Xin Xiong <[email protected]>
Cc: Xin Tan <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: Yang Li <[email protected]>
Cc: [email protected]
Cc: stable <[email protected]>
Reported-by: whitehat002 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Feb 11, 2022
1 parent 939f8b4 commit 9c25d5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mmc/host/moxart-mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,12 @@ static int moxart_remove(struct platform_device *pdev)
if (!IS_ERR(host->dma_chan_rx))
dma_release_channel(host->dma_chan_rx);
mmc_remove_host(mmc);
mmc_free_host(mmc);

writel(0, host->base + REG_INTERRUPT_MASK);
writel(0, host->base + REG_POWER_CONTROL);
writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF,
host->base + REG_CLOCK_CONTROL);
mmc_free_host(mmc);
}
return 0;
}
Expand Down

0 comments on commit 9c25d5f

Please sign in to comment.