Skip to content

Commit 1b41bea

Browse files
Yang Yingliangbroonie
authored andcommitted
ASoC: sof_es8336: fix possible use-after-free in sof_es8336_remove()
sof_es8336_remove() calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This means that the callback function may still be running after the driver's remove function has finished, which would result in a use-after-free. Fix by calling cancel_delayed_work_sync(), which ensures that the work is properly cancelled, no longer running, and unable to re-schedule itself. Fixes: 89cdb22 ("ASoC: sof_es8336: reduce pop noise on speaker") Signed-off-by: Yang Yingliang <[email protected]> Acked-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9472382 commit 1b41bea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/intel/boards/sof_es8336.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ static int sof_es8336_remove(struct platform_device *pdev)
783783
struct snd_soc_card *card = platform_get_drvdata(pdev);
784784
struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
785785

786-
cancel_delayed_work(&priv->pcm_pop_work);
786+
cancel_delayed_work_sync(&priv->pcm_pop_work);
787787
gpiod_put(priv->gpio_speakers);
788788
device_remove_software_node(priv->codec_dev);
789789
put_device(priv->codec_dev);

0 commit comments

Comments
 (0)