]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda - Fix endless loop of codec configure
authorTakashi Iwai <tiwai@suse.de>
Wed, 28 Jun 2017 10:02:02 +0000 (12:02 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 28 Jun 2017 10:10:05 +0000 (12:10 +0200)
commitd6fbeab40db562d22fb2d922ab284302facacdb9
treeef94286153e3104457ee51ed22a9aee1dd378605
parent9d335feb1e221cd7d16da71f7c8567ed5a203eeb
ALSA: hda - Fix endless loop of codec configure

azx_codec_configure() loops over the codecs found on the given
controller via a linked list.  The code used to work in the past, but
in the current version, this may lead to an endless loop when a codec
binding returns an error.

The culprit is that the snd_hda_codec_configure() unregisters the
device upon error, and this eventually deletes the given codec object
from the bus.  Since the list is initialized via list_del_init(), the
next object points to the same device itself.  This behavior change
was introduced at splitting the HD-audio code code, and forgotten to
adapt it here.

For fixing this bug, just use a *_safe() version of list iteration.

Fixes: 12aee353d1e1 ("ALSA: hda - Move some codes up to hdac_bus struct")
Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_controller.c