]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda - Register irq handler after the chip initialization
authorTakashi Iwai <tiwai@suse.de>
Tue, 30 Apr 2019 10:18:28 +0000 (12:18 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 30 Apr 2019 10:18:28 +0000 (12:18 +0200)
commit03174a9712740688db2a3820965dd3758c004e51
treee79aac6c73f4e3707dde412cccc3f5281e2a9f1f
parentdf94b59791a94988d13d78ca921fdba985ed446c
ALSA: hda - Register irq handler after the chip initialization

Currently the IRQ handler in HD-audio controller driver is registered
before the chip initialization.  That is, we have some window opened
between the azx_acquire_irq() call and the CORB/RIRB setup.  If an
interrupt is triggered in this small window, the IRQ handler may
access to the uninitialized RIRB buffer, which leads to a NULL
dereference Oops.

This is usually no big problem since most of Intel chips do register
the IRQ via MSI, and we've already fixed the order of the IRQ
enablement and the CORB/RIRB setup in the former commit 68777945bfd1
("sound: enable interrupt after dma buffer initialization"), hence the
IRQ won't be triggered in that room.  However, some platforms use a
shared IRQ, and this may allow the IRQ trigger by another source.

Another possibility is the kdump environment: a stale interrupt might
be present in there, the IRQ handler can be falsely triggered as well.

For covering this small race, let's move the azx_acquire_irq() call
after hda_intel_init_chip() call.  Although this is a bit radical
change, it can cover more widely than checking the CORB/RIRB setup
locally in the callee side.

Reported-by: Liwei Song <liwei.song@windriver.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_intel.c