Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1098232ybe; Fri, 13 Sep 2019 11:00:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqx60H8nunAnWKOYm6IdqYQftAmwcUKyg7wA2IO8aSwhD9k8M96CuPeWTLkWeLQWNzBR+q/5 X-Received: by 2002:a05:6402:1693:: with SMTP id a19mr30833022edv.140.1568397627210; Fri, 13 Sep 2019 11:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568397627; cv=none; d=google.com; s=arc-20160816; b=MCveyoEj0Wf0aqGYf9QpaRJqTngy5Sn9E/qr+82mZ7qL1h6LDTHRwqaSQBM1FNF7JI b/6B4neZ3h3Lb8sQINqfbiTq277Vzlqd1SO38TmZr8p5x0raosb1DaVAl7zeQ32B9as7 OWzQu3MbkJMC7XDfLsVU8X0Rjm+Fp/8CKfqvLXg2cSlreKT4WOhMFXnRy9zZAgT5ECpH TER7KiSpTzxds5B1+89nhY9/uDLCn0pQZilIaFjWOGd42osKvRnVUNdj2n9Ywb7+l1Hg 5YDk/BWYEAXYciGEAI+ybYPDq5j+XTN6cs+qeWQRQ7FodEg31TwosFMiODIsaXjEQZR3 JeVA== 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=q1f6PtqKe14mbf4c8e9DNyhKNk0irSB3nLcn09IyM78=; b=lXPL6LtXYt9bNuRUlb8L8FMC8g3K57OTxXiNmlIj5kUqYgnJ2TsX6NPD8laSxmTMY6 qRbEqZyPHpgLlQxyE4mywjRaKh2YmwqADPHIBqhehHlyJpSCKuFBnZ7LSGzqbf1vibIK fyn2N6G4QPL1AanD6jmSs9h1GgAab7TkmliPs2c7/JUGkvz6o48SkubvSfWddJbX1HtI 0Gy9d6/UBLSBNnlU8x7pytSrR7ByeLKon+47lSLC2ysA/R9yq5qlqizqLajhKXeXqyps GoAmic/U2OUVg30aQylA8fEDY0EXAZACoESWp5nerDff4jd3ZZ4o9vTvmWaBMuOy96RH YSbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LoMWz56d; 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 g8si18619541edb.335.2019.09.13.10.59.49; Fri, 13 Sep 2019 11:00:27 -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=LoMWz56d; 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 S2388312AbfIMNIe (ORCPT + 99 others); Fri, 13 Sep 2019 09:08:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:32982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388092AbfIMNId (ORCPT ); Fri, 13 Sep 2019 09:08:33 -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 8C06A206A5; Fri, 13 Sep 2019 13:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380113; bh=QrXK3JMoG6QA2Z3P6wUdIIr/jFFdmlem452gyj0jXfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LoMWz56dp+jr5AkaaP4DbdSoQM2gMuAVnqpIcNjWBwZvrwdvKOM/aYOHOEL7JD7Dm 5GnhA1DRxjPhA9KNWwPaXKh+LGiTaHZ+4guBszcmdlHBhzjboczbDshD5zPuZhvVbN niXOirbHbJ73hft449KDX0DltUXVeqvn0AI59nfQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.4 1/9] ALSA: hda - Fix potential endless loop at applying quirks Date: Fri, 13 Sep 2019 14:06:51 +0100 Message-Id: <20190913130426.113196443@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913130424.160808669@linuxfoundation.org> References: <20190913130424.160808669@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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 @@ -827,6 +827,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); @@ -866,8 +868,6 @@ static void apply_fixup(struct hda_codec } if (!fix->chained || fix->chained_before) break; - if (++depth > 10) - break; id = fix->chain_id; } }