lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca99047569fe34f84cdf83cacb49cb047d5dc389.camel@mediatek.com>
Date: Wed, 27 Nov 2024 05:28:58 +0000
From: Trevor Wu (吳文良) <Trevor.Wu@...iatek.com>
To: "broonie@...nel.org" <broonie@...nel.org>,
	"kuninori.morimoto.gx@...esas.com" <kuninori.morimoto.gx@...esas.com>,
	"tiwai@...e.com" <tiwai@...e.com>, "lgirdwood@...il.com"
	<lgirdwood@...il.com>, "matthias.bgg@...il.com" <matthias.bgg@...il.com>,
	"perex@...ex.cz" <perex@...ex.cz>, AngeloGioacchino Del Regno
	<angelogioacchino.delregno@...labora.com>, Nicolas Prado
	<nfraprado@...labora.com>
CC: "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "kernel@...labora.com"
	<kernel@...labora.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-sound@...r.kernel.org"
	<linux-sound@...r.kernel.org>, "linux-mediatek@...ts.infradead.org"
	<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH] ASoC: mediatek: Check num_codecs is not zero to avoid
 panic during probe

On Tue, 2024-11-26 at 15:09 -0500, Nícolas F. R. A. Prado wrote:

> 
> Following commit 13f58267cda3 ("ASoC: soc.h: don't create dummy
> Component via COMP_DUMMY()"), COMP_DUMMY() became an array with zero
> length, and only gets populated with the dummy struct after the card
> is
> registered. Since the sound card driver's probe happens before the
> card
> registration, accessing any of the members of a dummy component
> during
> probe will result in undefined behavior.
> 
> This can be observed in the mt8188 and mt8195 machine sound drivers.
> By
> omitting a dai link subnode in the sound card's node in the
> Devicetree,
> the default uninitialized dummy codec is used, and when its dai_name
> pointer gets passed to strcmp() it results in a null pointer
> dereference
> and a kernel panic.
> 
> In addition to that, set_card_codec_info() in the generic helpers
> file,
> mtk-soundcard-driver.c, will populate a dai link with a dummy codec
> when
> a dai link node is present in DT but with no codec property.
> 
> The result is that at probe time, a dummy codec can either be
> uninitialized with num_codecs = 0, or be an initialized dummy codec,
> with num_codecs = 1 and dai_name = "snd-soc-dummy-dai". In order to
> accommodate for both situations, check that num_codecs is not zero
> before accessing the codecs' fields but still check for the codec's
> dai
> name against "snd-soc-dummy-dai" as needed.
> 
> While at it, also drop the check that dai_name is not null in the
> mt8192
> driver, introduced in commit 4d4e1b6319e5 ("ASoC: mediatek: mt8192:
> Check existence of dai_name before dereferencing"), as it is actually
> redundant given the preceding num_codecs != 0 check.
> 
> Fixes: 13f58267cda3 ("ASoC: soc.h: don't create dummy Component via
> COMP_DUMMY()")
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@...labora.com>
> ---
> 

Acked-by: Trevor Wu <trevor.wu@...iatek.com>

Thank you for the patch.


Thanks,
Trevor

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ