Skip to content

Commit

Permalink
ASoC: hdac_hda: fix race in device removal
Browse files Browse the repository at this point in the history
When ASoC card instance is removed containing a HDA codec,
hdac_hda_codec_remove() may run in parallel with codec resume.
This will cause problems if the HDA link is freed with
snd_hdac_ext_bus_link_put() while the codec is still in
middle of its resume process.

To fix this, change the order such that pm_runtime_disable()
is called before the link is freed. This will ensure any
pending runtime PM action is completed before proceeding
to free the link.

This issue can be easily hit with e.g. SOF driver by loading and
unloading the drivers.

Signed-off-by: Kai Vehmanen <[email protected]>
  • Loading branch information
kv2019i authored and ranj063 committed Oct 29, 2019
1 parent 195c173 commit f5e70ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/codecs/hdac_hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)
return;
}

snd_hdac_ext_bus_link_put(hdev->bus, hlink);
pm_runtime_disable(&hdev->dev);
snd_hdac_ext_bus_link_put(hdev->bus, hlink);
}

static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = {
Expand Down

0 comments on commit f5e70ce

Please sign in to comment.