Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit a69270d8 authored by Kai Vehmanen's avatar Kai Vehmanen Committed by Mark Brown
Browse files

ASoC: SOF: fix race in FW boot timeout handling



A race condition exists in handling firmware boot timeout.
If FW sends FW_READY just after boot timeout has expired in
driver, a kernel exception will result as FW_READY handler
will be run while the state is still being cleaned up in
snd_sof_run_firmware(). Avoid the race by setting
boot_complete also in the error case.

Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8d01c3c7
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -372,6 +372,8 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
				 msecs_to_jiffies(sdev->boot_timeout));
				 msecs_to_jiffies(sdev->boot_timeout));
	if (ret == 0) {
	if (ret == 0) {
		dev_err(sdev->dev, "error: firmware boot failure\n");
		dev_err(sdev->dev, "error: firmware boot failure\n");
		/* after this point FW_READY msg should be ignored */
		sdev->boot_complete = true;
		snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX |
		snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX |
			SOF_DBG_TEXT | SOF_DBG_PCI);
			SOF_DBG_TEXT | SOF_DBG_PCI);
		return -EIO;
		return -EIO;