Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3850331pxb; Tue, 17 Nov 2020 05:22:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+dEKOotFsE4AQKtOVf7cJaLpLnkueNucZ4i7IoUSU498pkRBfimnDWYCgakZp0F5guGJE X-Received: by 2002:a05:6402:1155:: with SMTP id g21mr20631218edw.53.1605619320671; Tue, 17 Nov 2020 05:22:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619320; cv=none; d=google.com; s=arc-20160816; b=C94nz/cuZcoTg0lD/auCq28SggpfleUdhlKVUtTRhaJV3vHaHjWmpHwaG2G8N7tgM0 jRgGFmCl30MFqUadqxIwg+6kycwIkCbj6rdWkrpUNjWruO3XOLMpieUibh09uf2CyzHk H6MRgzTD3P5U8ApikJjIlkvHvfYdnybDFIuikg+zIOqyhcmA1jZxYMFN998g75KWIfU5 XcPnvm9EuRjeGZkzIM3zoNqvh7ZiovRbhQrzWjLri9/e7lsLFrKcMmmu6j0alMivN/NS B1v/aCsluIBCf3TBGDlPGW9imXu9WsIkHPc92POYQgSesBjEMaPr5jdo35qXL9qi8j+k /NNA== 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=EOpxLrB+kLGuNb7DMiX58HpKBhtB42S8xO8Favv26mY=; b=OhnraCwleTP+r82TU9WLF5IzfWWPyryfXDHzVQhuL8DnvChROwlXa1Kln21pgDmwwm YOIzBmIYQ9klcPUVKEwQmeT3LW8rmK03tSH9WPtd5aobJh9iSGXMx0RwAW82cXxP1DxL AXbub73g4d8jLoYjKSbgVIygR2DUzY8NbT9AcYP1lgvhhKRQWAJHPuK2dDZr/Eir+ut6 MulkPHmXUvzS/PaZqFAISjEUyNrhlnprkmNZMreUuFKXPtmFvNuE9UfoxibIzGyQZ19Q CVE1DMi+Ez4NSSSaoqLojGAkqA4quoiSjca2235LAiEyhGjmoyS8e9VuGCI6KHoklitA eiTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a2Jwq2yT; 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 u20si13325173eje.628.2020.11.17.05.21.37; Tue, 17 Nov 2020 05:22:00 -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=a2Jwq2yT; 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 S1730287AbgKQNT0 (ORCPT + 99 others); Tue, 17 Nov 2020 08:19:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:52172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730351AbgKQNTJ (ORCPT ); Tue, 17 Nov 2020 08:19:09 -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 A5CFA2225B; Tue, 17 Nov 2020 13:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619149; bh=oqeDd4a3Fmq33C+gwWg+eSMtbCwt+2TJ4SWpCJQWqEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a2Jwq2yTC6cVVUyTYFSKjs7HbbLeDDdavY/ogZaaBNU14nEM8HEOA85UoeSxqwqZm jrccJe/UOkGHn5IGs5hzJryIrpCiQa+zrVjJ6lBw2HAspdIgBAfJcFyULMnxzeeVV1 +j0XBnJAYbDZznc7u7DrWh5zlKFaI5ttnABcM9/0= 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.19 014/101] ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link() Date: Tue, 17 Nov 2020 14:04:41 +0100 Message-Id: <20201117122113.797173694@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@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 84b44cdae28a1..b96abebcfd1a4 100644 --- a/sound/hda/ext/hdac_ext_controller.c +++ b/sound/hda/ext/hdac_ext_controller.c @@ -156,6 +156,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