From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] soc: soc-core: fix a missing check on list iterator
Date: Sun, 27 Mar 2022 23:31:19 +0000 [thread overview]
Message-ID: <87zglbug5a.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <20220327082018.13585-1-xiam0nd.tong@gmail.com>
Hi Xiaomeng
Thank you for your patch
> The bug is here:
> *dai_name = dai->driver->name;
>
> For for_each_component_dais, just like list_for_each_entry,
> the list iterator 'dai' will point to a bogus position
> containing HEAD if the list is empty or no element is found.
> This case must be checked before any use of the iterator,
> otherwise it will lead to a invalid memory access.
>
> To fix the bug, use a new variable 'iter' as the list iterator,
> while use the original variable 'dai' as a dedicated pointer
> to point to the found element.
>
> Cc: stable@vger.kernel.org
> Fixes: 58bf4179000a3 ("ASoC: soc-core: remove dai_drv from snd_soc_component")
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
> ---
From "code" point of view, indeed current code doesn't care non-find case,
but from "logic" point of view, it should find target DAI here.
If it couldn't find the DAI, it means
"This is the target component, but it doesn't have target DAI",
and it is very strange for me.
If you got such bug, it is CPU or Codec driver side bug, I think.
If this is for security reason, indicating such message somewhere
(for example by /* comment */) is nice idea for me.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
prev parent reply other threads:[~2022-03-27 23:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-27 8:20 Xiaomeng Tong
2022-03-27 23:31 ` Kuninori Morimoto [this message]
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=87zglbug5a.wl-kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx@renesas.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=xiam0nd.tong@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®