Skip to content

Commit eea46a0

Browse files
committed
ALSA: hda/hdmi: Cancel pending works before suspend
The per_pin->work might be still floating at the suspend, and this may hit the access to the hardware at an unexpected timing. Cancel the work properly at the suspend callback for avoiding the buggy access. Note that the bug doesn't trigger easily in the recent kernels since the work is queued only when the repoll count is set, and usually it's only at the resume callback, but it's still possible to hit in theory. BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1182377 Reported-and-tested-by: Abhishek Sahu <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5ff9dde commit eea46a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sound/pci/hda/patch_hdmi.c

+13
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,18 @@ static void generic_hdmi_free(struct hda_codec *codec)
24802480
}
24812481

24822482
#ifdef CONFIG_PM
2483+
static int generic_hdmi_suspend(struct hda_codec *codec)
2484+
{
2485+
struct hdmi_spec *spec = codec->spec;
2486+
int pin_idx;
2487+
2488+
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
2489+
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
2490+
cancel_delayed_work_sync(&per_pin->work);
2491+
}
2492+
return 0;
2493+
}
2494+
24832495
static int generic_hdmi_resume(struct hda_codec *codec)
24842496
{
24852497
struct hdmi_spec *spec = codec->spec;
@@ -2503,6 +2515,7 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
25032515
.build_controls = generic_hdmi_build_controls,
25042516
.unsol_event = hdmi_unsol_event,
25052517
#ifdef CONFIG_PM
2518+
.suspend = generic_hdmi_suspend,
25062519
.resume = generic_hdmi_resume,
25072520
#endif
25082521
};

0 commit comments

Comments
 (0)