Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1124711ybe; Fri, 13 Sep 2019 11:24:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMtL+YibmFATVBhSV8Gshg5TSzOugdHpJ0w2yy9zASiMRHYBztds3hbX7VsTaBM+tG4Ei4 X-Received: by 2002:a17:906:6b0f:: with SMTP id q15mr1759175ejr.200.1568399079138; Fri, 13 Sep 2019 11:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568399079; cv=none; d=google.com; s=arc-20160816; b=C1ddPIVMjomyuQQVT3S19N2SHN4snWnuwLsBhKfwaAMVH4OiA6XsrPfDxCvLEApWX+ kaijQr/DZuZMJeDuvJJGya3UnVckcY6cEclHd3kqz8gIqyP9eAzHT7A6/O3OSwom+3H/ 47B2cYfwyP5PaA94JyNUML8KMMCHnAiiqLR9e1xh1k1Y1jwjXvyYINlqdpk/mvQBHWzR qYBjBEKC0X7vDMYSCLL961fs8W11rafG/5lEulR2VVy0mNGj8CJKFh5Wb+lGitzxnOGX J9Ny20P28uzg2DhLTRJWa6DDbnY7L1DktXMIHJsPinMu1aWVGv7JEjaP0k+VquZaeo/O jaVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BI6WWoYWcRnTezTlw5O6/nR9AOnWIMjj9D8aPs7cQBg=; b=j4MxBOiRIT89Uri92GCPtIOE9QEWXE4W8GQGkLOnq7Jx0OsQ2p7Xj0M+SEHqFwbE37 szjbWoNoHsl02F5ACTBm2ogC/n/Yhc/O3CUvekJQ1+1+U70Fx6iMVnA+VLq966fm8mIF Ey6qbXCHjOQxjgvKt3lr4MId8i+GprD9yOsvOjpb7sgiyYopCyrCkjeD2myjCniWTeub VELwpimu/C0VSxzCCnO79JwOdpX7ix1xQIxLR+qPsyFeurQ/4pjd3TEdFtHoFAfGitSR SKahAbLvEVzDuF4mMB6dHNjejrDXcIMjN2Gbr5degkarmcY3PQoa29vm5vNP2MJm9KSx lc/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n92i55jS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bt13si445986edb.245.2019.09.13.11.24.15; Fri, 13 Sep 2019 11:24:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n92i55jS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388960AbfIMNU7 (ORCPT + 99 others); Fri, 13 Sep 2019 09:20:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:50260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390680AbfIMNU4 (ORCPT ); Fri, 13 Sep 2019 09:20:56 -0400 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1AF29214DE; Fri, 13 Sep 2019 13:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380855; bh=zm2mKZJbhXD36e1PCCkOnk5RqOK1VDdH6CD1TDRaXx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n92i55jSaMkFBOyN72YUTj6OGA24TTvRyrxRtb1GpG54rqPcbCKDPJ4uYxCrh5PFf eIisXErE+zW6xGyX5vPkwOH2Besnt3GCLs1xM8dKbAXzzlaeJZIEnfSOf5VBog3i68 H5qq9O7LwFt8grxnVecQEUWbVm1UMYiDQQI5CP4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.2 03/37] ALSA: hda - Fix potential endless loop at applying quirks Date: Fri, 13 Sep 2019 14:07:08 +0100 Message-Id: <20190913130511.612416529@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913130510.727515099@linuxfoundation.org> References: <20190913130510.727515099@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai 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: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_auto_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c @@ -824,6 +824,8 @@ static void apply_fixup(struct hda_codec 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); @@ -863,8 +865,6 @@ static void apply_fixup(struct hda_codec } if (!fix->chained || fix->chained_before) break; - if (++depth > 10) - break; id = fix->chain_id; } }