All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Stephan Gerhold <stephan@gerhold.net>, Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org,
	Banajit Goswami <bgoswami@codeaurora.org>,
	Srinivasa Rao Mandadapu <srivasam@codeaurora.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH v2] ASoC: qcom: lpass: Fix out-of-bounds DAI ID lookup
Date: Mon, 25 Jan 2021 11:01:50 +0000	[thread overview]
Message-ID: <5839ced8-4dba-398a-6637-139749850819@linaro.org> (raw)
In-Reply-To: <20210125104442.135899-1-stephan@gerhold.net>



On 25/01/2021 10:44, Stephan Gerhold wrote:
> 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 <srivasam@codeaurora.org>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---
> Changes in v2:
>    - Extracted from https://lore.kernel.org/alsa-devel/20210114094615.58191-2-stephan@gerhold.net/
>    - Change commit message to clarify that this is usually not just
>      redundant now but actually a broken out-of-bounds lookup.
> ---
>   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 405542832e99..baf72f124ea9 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))
>   
> 

  reply	other threads:[~2021-01-25 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 10:44 [PATCH v2] ASoC: qcom: lpass: Fix out-of-bounds DAI ID lookup Stephan Gerhold
2021-01-25 11:01 ` Srinivas Kandagatla [this message]
2021-01-25 14:17 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5839ced8-4dba-398a-6637-139749850819@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=srivasam@codeaurora.org \
    --cc=stephan@gerhold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.