提交 40a19ffe 编写于 作者: T Takashi Iwai 提交者: Xie XiuQi

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: 1f578250 ("ALSA: hda - Add chained_before flag to the fixup entry")
Cc: <stable@vger.kernel.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3e12d0d3
...@@ -828,6 +828,8 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth) ...@@ -828,6 +828,8 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
while (id >= 0) { while (id >= 0) {
const struct hda_fixup *fix = codec->fixup_list + id; const struct hda_fixup *fix = codec->fixup_list + id;
if (++depth > 10)
break;
if (fix->chained_before) if (fix->chained_before)
apply_fixup(codec, fix->chain_id, action, depth + 1); 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) ...@@ -867,8 +869,6 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
} }
if (!fix->chained || fix->chained_before) if (!fix->chained || fix->chained_before)
break; break;
if (++depth > 10)
break;
id = fix->chain_id; id = fix->chain_id;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册