summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-08-29 09:52:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-16 08:21:39 +0200
commit2c4d2ce8b7998b914401b66d12b1f7f316ff0db8 (patch)
tree72826446dc6baad1ce9dd551f87b0f6fc60ab68c /sound
parentee809c7e08956d737cb66454f5b6ca32cc0d9f26 (diff)
downloadlinux-stable-2c4d2ce8b7998b914401b66d12b1f7f316ff0db8.tar.gz
linux-stable-2c4d2ce8b7998b914401b66d12b1f7f316ff0db8.tar.bz2
linux-stable-2c4d2ce8b7998b914401b66d12b1f7f316ff0db8.zip
ALSA: hda - Fix potential endless loop at applying quirks
commit 333f31436d3db19f4286f8862a00ea1d8d8420a1 upstream. Since the chained quirks via chained_before flag is applied before the depth check, it may lead to the endless recursive calls, when the chain were set up incorrectly. Fix it by moving the depth check at the beginning of the loop. Fixes: 1f57825077dc ("ALSA: hda - Add chained_before flag to the fixup entry") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_auto_parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index b9a6b66aeb0e..d8ba3a6d5042 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -828,6 +828,8 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
while (id >= 0) {
const struct hda_fixup *fix = codec->fixup_list + id;
+ if (++depth > 10)
+ break;
if (fix->chained_before)
apply_fixup(codec, fix->chain_id, action, depth + 1);
@@ -867,8 +869,6 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
}
if (!fix->chained || fix->chained_before)
break;
- if (++depth > 10)
- break;
id = fix->chain_id;
}
}