Skip to content

Commit 098a0a6

Browse files
committed
ALSA: hda: Abort capability probe at invalid register read
The loop in snd_hdac_bus_parse_capabilities() may go to nirvana when it hits an invalid register value read: BUG: unable to handle kernel paging request at ffffad5dc41f3fff IP: pci_azx_readl+0x5/0x10 [snd_hda_intel] Call Trace: snd_hdac_bus_parse_capabilities+0x3c/0x1f0 [snd_hda_core] azx_probe_continue+0x7d5/0x940 [snd_hda_intel] ..... This happened on a new Intel machine, and we need to check the value and abort the loop accordingly. [Note: the fixes tag below indicates only the commit where this patch can be applied; the original problem was introduced even before that commit] Fixes: 6720b38 ("ALSA: hda - move bus_parse_capabilities to core") Cc: <[email protected]> Acked-by: Vinod Koul <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 8009d50 commit 098a0a6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sound/hda/hdac_controller.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
284284
dev_dbg(bus->dev, "HDA capability ID: 0x%x\n",
285285
(cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
286286

287+
if (cur_cap == -1) {
288+
dev_dbg(bus->dev, "Invalid capability reg read\n");
289+
break;
290+
}
291+
287292
switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
288293
case AZX_ML_CAP_ID:
289294
dev_dbg(bus->dev, "Found ML capability\n");

0 commit comments

Comments
 (0)