Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp647773pxb; Tue, 2 Feb 2021 14:17:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwY7SIZE/qqoZnEBHRw8TBUU8zVYCL739rheokQYhnLHIBv7Yy6TQ0e95xVZRTC3+FsO0z X-Received: by 2002:a17:906:118f:: with SMTP id n15mr113264eja.497.1612304240232; Tue, 02 Feb 2021 14:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612304240; cv=none; d=google.com; s=arc-20160816; b=JGYDSsO9WFIyCdtr0NiMmxy5ClZxW2EKjKonw4ziEIqfH/7+hR3yrWqJL0p3o0oytA gMq3q0LjInk+0g9ioWKgrVwpyn6JdsliA2+U/YT63mv79SfPwzxxlWwRdTdraHP1A0aW Ge67cy3/IjK1SsH36iR1p2A6KQke6gglgV1fGbqPMKJHFPZmzFHHYQnOmm7qvEhOwgL1 o4d5ftwq4syPrcNSBYMka3fM+wBFvddj6wwjzkn5TmASNidPwbv0OuDnkgdJ7djYXPTo a7ELffXKh7YefAcmVZRBNbXTDFrrVEE72Wk9pXmaTe6nvWTD4kn8rZExJTcohNtjLCTX yb9Q== 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=4dZ14HH6PkvzM0vAB6FscwHtObkfHD56oxMDEG4yH2I=; b=Oejf4BKR1HuZAqek2ORUrxY0gevbnqS7i/z+htlgSxKfbYW3JQo3TNBOb92PZ1yFRJ LixW0OD1THZ9s1iIGNwMyIsPFWDy2LFZ28A+Ke7M34YTI0VKtrCi/BEt3sGNegS4FQmy iJwwbuc/ZrJzq8+8JiO+tAmqzomGTKsKrpLNaPvkVRuQFH9y6sJ5RbAhlx3NC24zrY5R U1LpMB+vambJOru4NzK55no5/6SKO2E/3QVXUgvxoISxncL1TogsesUs81ssG11ImpSq QEu+PWD/andNUtNxAFOKYC43XDr7sIOSjPjA0Ry0+DT2/1JoQudg5hXdC6M07vkjFUyl oOHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RpFtPBtu; 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=pass (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 ho11si119205ejc.367.2021.02.02.14.16.55; Tue, 02 Feb 2021 14:17:20 -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=@linuxfoundation.org header.s=korg header.b=RpFtPBtu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233478AbhBBN5l (ORCPT + 99 others); Tue, 2 Feb 2021 08:57:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:41108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233126AbhBBNvx (ORCPT ); Tue, 2 Feb 2021 08:51:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 24A0664FBB; Tue, 2 Feb 2021 13:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273418; bh=JjyaAa0fvSRvaup4My50xq+W9CTjToQ9nFsyguBRguw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RpFtPBtuhbPn+hZgYdaBPkI6Xu+FTQDLgRc2jkZM5ZNeRlGJzWJXQfyPemrwkSmTb zu8EBR+mFxeL9kRKywImbWJ2O8C+7NA9qkQ06sWOf48lIzv5nqXrHRKkLg6Wl+Apwt DRklxkLMbqrqIAcjafIsfOoP4IuUfY2l+jME3GiU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivasa Rao Mandadapu , Srinivas Kandagatla , Stephan Gerhold , Mark Brown , Sasha Levin Subject: [PATCH 5.10 099/142] ASoC: qcom: lpass: Fix out-of-bounds DAI ID lookup Date: Tue, 2 Feb 2021 14:37:42 +0100 Message-Id: <20210202133001.797749691@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Stephan Gerhold [ Upstream commit 70041000450d0a071bf9931d634c8e2820340236 ] The "dai_id" given into LPAIF_INTFDMA_REG(...) is already the real DAI ID, not an index into v->dai_driver. Looking it up again seems entirely redundant. For IPQ806x (and SC7180 since commit 09a4f6f5d21c ("ASoC: dt-bindings: lpass: Fix and common up lpass dai ids") this is now often an out-of-bounds read because the indexes in the "dai_driver" array no longer match the actual DAI ID. Cc: Srinivasa Rao Mandadapu Cc: Srinivas Kandagatla Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver") Signed-off-by: Stephan Gerhold Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20210125104442.135899-1-stephan@gerhold.net Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/qcom/lpass-lpaif-reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h index 405542832e994..baf72f124ea9b 100644 --- a/sound/soc/qcom/lpass-lpaif-reg.h +++ b/sound/soc/qcom/lpass-lpaif-reg.h @@ -133,7 +133,7 @@ #define LPAIF_WRDMAPERCNT_REG(v, chan) LPAIF_WRDMA_REG_ADDR(v, 0x14, (chan)) #define LPAIF_INTFDMA_REG(v, chan, reg, dai_id) \ - ((v->dai_driver[dai_id].id == LPASS_DP_RX) ? \ + ((dai_id == LPASS_DP_RX) ? \ LPAIF_HDMI_RDMA##reg##_REG(v, chan) : \ LPAIF_RDMA##reg##_REG(v, chan)) -- 2.27.0