Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3847664pxb; Tue, 17 Nov 2020 05:18:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVwO1rjlWt1ITZWU5mM8SEt8Jl/HP0stO8pYMQU/lNd/bwZX+yR2VUABQEyYjfQR6Lq5lm X-Received: by 2002:aa7:d709:: with SMTP id t9mr21527872edq.305.1605619102836; Tue, 17 Nov 2020 05:18:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619102; cv=none; d=google.com; s=arc-20160816; b=bvURvRAtsgGeMJmh/Ri/ntQWUBHlQE6/6Oh0+1bOkxxSb+5UDOOILB9MynWOqhTYWd 5jy8qWgbxbFuoy4lT7lq+85wVPQx0ZepooFcJLVneeqgvCx73PC44VBjeB5DvclB4w+y oBj/ZK0OQsb7H3nLPiDHwoqoVDmBJNg9k5hrIAuR6ny0GmjhhGDyCyWjuJVfld0C2aMM efuO/XpvftJllCvlZ1tuGKAAwQPXqLmmgnoQD5hHJawFu0H3IdNlCQzUtgU6Oc0s6ui4 w7KKcAQ2uK+gL75B++NKWsoWS3vi6ukox7XjS7fdHmNXdE5ddmWaiwI9Vm/AaDKRLP9b aAZA== 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=TlQD/hRjQUzLheGBp0hnb3uqQebZ46RTlbURQAh8pRs=; b=rqXskEeRZY49N8MrGdEwhN1aDgw3i/M3lU6M3iqSQCwyAiHi4m9gCODN6byD+VraTF EEtMy3LMlCUIu7RhIqOnjEhWCvwdy1uhQ4X8576x3wfwaMx631RrtCXV97UXJJM0WWzY 0lycg9WuJ2mvUMroxmv6p4XGQZyjSXLXcCvJHppb2diJcisgiVOR2biPvXClbDAJGn5Y y0+nAL/ajRP/2DCHTLNv5Anj/Y03KsCmc1IJeSQ2aUa/BfP6nko0zozng0i4PJ11PlpR CJwa2dpClmpyZ0e3APv69xKy1EAYOvHaWRhnutn5BeHfNTRbDv4yMgkHF9p8HGTg2xTF 7Eug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dCeD+Qda; 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 ba14si13805041edb.54.2020.11.17.05.18.00; Tue, 17 Nov 2020 05:18:22 -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=dCeD+Qda; 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 S1729676AbgKQNN3 (ORCPT + 99 others); Tue, 17 Nov 2020 08:13:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:43712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729948AbgKQNNV (ORCPT ); Tue, 17 Nov 2020 08:13:21 -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 3C8842225B; Tue, 17 Nov 2020 13:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618800; bh=di5cSrTeag/RmFy7tCw5MxC3Y59sAQtTkEwdi41AJfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dCeD+QdaUW+XRq6ejR8kCvi3AF+WIE8GTG7mfv8D943gOFnnrFpBEIcfUyXblBaaz r5ZH94sgpyKE7XVvIyoL4JUdw5EG4WGe/0HpJuEJlJb0F0XYP2EIW0YAM9Hv/HzoF4 iVoMcNOze5sWn1LglLEwyAuhKGGVoWQUu3B0rgGM= 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 4.14 12/85] ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link() Date: Tue, 17 Nov 2020 14:04:41 +0100 Message-Id: <20201117122111.639283353@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122111.018425544@linuxfoundation.org> References: <20201117122111.018425544@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 84f3b81687164..b679d5f37e4d2 100644 --- a/sound/hda/ext/hdac_ext_controller.c +++ b/sound/hda/ext/hdac_ext_controller.c @@ -155,6 +155,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus, return NULL; if (ebus->idx != bus_idx) return NULL; + if (addr < 0 || addr > 31) + return NULL; list_for_each_entry(hlink, &ebus->hlink_list, list) { for (i = 0; i < HDA_MAX_CODECS; i++) { -- 2.27.0