mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
spi: mpc52xx: fix use-after-free on unbind
commit706b3dc2acupstream. The state machine work is scheduled by the interrupt handler and therefore needs to be cancelled after disabling interrupts to avoid a potential use-after-free. Fixes:984836621a("spi: mpc52xx: Add cancel_work_sync before module remove") Cc: stable@vger.kernel.org Cc: Pei Xiao <xiaopei01@kylinos.cn> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260414134319.978196-5-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
59abb878f5
commit
bb6b50f709
@@ -519,10 +519,11 @@ static void mpc52xx_spi_remove(struct platform_device *op)
|
||||
struct mpc52xx_spi *ms = spi_master_get_devdata(master);
|
||||
int i;
|
||||
|
||||
cancel_work_sync(&ms->work);
|
||||
free_irq(ms->irq0, ms);
|
||||
free_irq(ms->irq1, ms);
|
||||
|
||||
cancel_work_sync(&ms->work);
|
||||
|
||||
for (i = 0; i < ms->gpio_cs_count; i++)
|
||||
gpiod_put(ms->gpio_cs[i]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user