Skip to content

Commit df27e4d

Browse files
Bob Songtiwai
authored andcommitted
ALSA: hda: Check snd_hda_power_pm construct error before executing verb
When userspace writes 1 to /sys/bus/pci/devices/XX/remove to remove HDA PCI device, the HDA hardware control path is shut down and devres unmaps the BAR virtual address bus->remap_addr automatically during driver removal. If a delayed HDA verb command arrives after the MMIO region is unmapped, the driver will access invalid virtual addresses and trigger a page fault splat. So add an error check right after constructing snd_hda_power_pm. Signed-off-by: Bob Song <songxiebing@kylinos.cn> Link: https://patch.msgid.link/20260717024948.506335-1-songxiebing@kylinos.cn Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 260fc7a commit df27e4d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sound/hda/common/codec.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ static int call_exec_verb(struct hda_bus *bus, struct hda_codec *codec,
3939
int err;
4040

4141
CLASS(snd_hda_power_pm, pm)(codec);
42+
if (pm.err < 0 && !bus->core.chip_init) {
43+
codec_warn(codec,
44+
"Failed to send cmd 0x%x ret=[%d], hda control stopped\n",
45+
cmd, pm.err);
46+
return pm.err;
47+
}
4248
guard(mutex)(&bus->core.cmd_mutex);
4349
if (flags & HDA_RW_NO_RESPONSE_FALLBACK)
4450
bus->no_response_fallback = 1;

0 commit comments

Comments
 (0)