Skip to content

Commit ab58d8c

Browse files
Lekensteyntiwai
authored andcommitted
ALSA: hda - fix use-after-free after module unload
register_vga_switcheroo() sets the PM ops from the hda structure which is freed later in azx_free. Make sure that these ops are cleared. Caught by KASAN, initially noticed due to a general protection fault. Fixes: 246efa4 ("snd/hda: add runtime suspend/resume on optimus support (v4)") Signed-off-by: Peter Wu <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent a8ff48c commit ab58d8c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/pci/hda/hda_intel.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,10 @@ static int azx_free(struct azx *chip)
12181218
if (use_vga_switcheroo(hda)) {
12191219
if (chip->disabled && hda->probe_continued)
12201220
snd_hda_unlock_devices(&chip->bus);
1221-
if (hda->vga_switcheroo_registered)
1221+
if (hda->vga_switcheroo_registered) {
12221222
vga_switcheroo_unregister_client(chip->pci);
1223+
vga_switcheroo_fini_domain_pm_ops(chip->card->dev);
1224+
}
12231225
}
12241226

12251227
if (bus->chip_init) {

0 commit comments

Comments
 (0)