Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3871177pxb; Tue, 17 Nov 2020 05:53:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3DLDcZCZY0Ycp0RrxotfAVgUEoqwzDWkeLrBt/tUXKax3TUXgtpR/kemH6zd/pGwO+uH6 X-Received: by 2002:a17:906:4e90:: with SMTP id v16mr20377948eju.477.1605621185817; Tue, 17 Nov 2020 05:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621185; cv=none; d=google.com; s=arc-20160816; b=UeQdoCujICvcXBkfgTzMcyWZABKzMqz6P1FyXjp8t7rsaVEt4Scvoemt/8ckj0QZd2 c+yYaWsOurDP4uwZPGwZEKWanfWeTjJzoRes+HBaorl3UTdNecSmncQqHKXeK19cSiBK fz9rwslg2chysqYlc0weqt3BKnYiyU4R1cGr7CIYZsfd6EJCnX5dQ0VVKjEtxZAbvZnr sDCdZBnPbtrYDmPfF3PeoilzObZA5+8MuE2IJPOVvFVyx3kPXgyBQym1PdlO1hzImbxH tAfSM1QiEabpUXtdLlLZ5pLC4Pj9GSK0sqU/mULZRWC+LA48AlQjHG25l8JlZuXH4FVq DsZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rbZFBrMcL6TVLpkVqjUX1hgiDnfvmQQCFDaMUmuGlg8=; b=vSucU0zu7SZfFbDzyoTN+tsB08WpwTzmpe+b85DApHn+FWE8RSvjVBMP4BpkQt6C3d 9pjZKTDaDex7FlsntZJHMuJ8oVdRQVvIwQMcuE88p9Lg+G8b1SkF35Z4S70byq6WhJQ+ bEDKRaPbVDIY3VGtb4eaLIyjmYeR1P/eo+g7YTH6XUBJJYvKkeAEHIq0Ks4GVplbxNs3 paA4DXDy0LBPmhAvbhe0cAbRuXN6tHFb2zdFkAuHBcinazdCdzsVrHn2AS4VgpBfxNFA K9FsaQHgNEsX8k7+YFG0szbqkrRLGDM7vBEthnOQniWDd2mIW/ZjoJMHfDjM9MuM/A1w YNiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yhPL3Zu+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb40si13060263ejc.506.2020.11.17.05.52.42; Tue, 17 Nov 2020 05:53:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yhPL3Zu+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732219AbgKQNbz (ORCPT + 99 others); Tue, 17 Nov 2020 08:31:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:41006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731050AbgKQNbd (ORCPT ); Tue, 17 Nov 2020 08:31:33 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 36325207BC; Tue, 17 Nov 2020 13:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619891; bh=Wez/BHtNgnF7/M4VFuCdsqQ7JRObwFmMz+veloJes34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yhPL3Zu+pNjTgrACZ3HMJoch1G2gY5/uzJmwCGg5EDZv8Rop/F7rC9cNiWdYpllnj A4sTct5sXN82oKUTQT9ptXr0FazperBAZQEfE0YBGS0vcm5Not63Eym+Sr5CRXrcfc wBTRafktej/zeztcC1SZHpev/7AYC6Ngd4P/UQc8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Takashi Iwai , Sasha Levin Subject: [PATCH 5.9 039/255] ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link() Date: Tue, 17 Nov 2020 14:02:59 +0100 Message-Id: <20201117122140.850332057@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 158e1886b6262c1d1c96a18c85fac5219b8bf804 ] This is harmless, but the "addr" comes from the user and it could lead to a negative shift or to shift wrapping if it's too high. Fixes: 0b00a5615dc4 ("ALSA: hdac_ext: add hdac extended controller") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20201103101807.GC1127762@mwanda Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/hda/ext/hdac_ext_controller.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c index 4d060d5b1db6d..b0c0ef824d7d9 100644 --- a/sound/hda/ext/hdac_ext_controller.c +++ b/sound/hda/ext/hdac_ext_controller.c @@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, return NULL; if (bus->idx != bus_idx) return NULL; + if (addr < 0 || addr > 31) + return NULL; list_for_each_entry(hlink, &bus->hlink_list, list) { for (i = 0; i < HDA_MAX_CODECS; i++) { -- 2.27.0