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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ac635ae5-5486-4243-901d-701f2ee90809@intel.com>
Date: Wed, 14 May 2025 15:48:27 +0200
From: Cezary Rojewski <cezary.rojewski@...el.com>
To: Wentao Liang <vulab@...as.ac.cn>
CC: <kuninori.morimoto.gx@...esas.com>, <tony.luck@...el.com>,
	<amadeuszx.slawinski@...ux.intel.com>, <linux-sound@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
	<liam.r.girdwood@...ux.intel.com>, <peter.ujfalusi@...ux.intel.com>,
	<yung-chuan.liao@...ux.intel.com>, <ranjani.sridharan@...ux.intel.com>,
	<kai.vehmanen@...ux.intel.com>, <pierre-louis.bossart@...ux.dev>,
	<broonie@...nel.org>, <perex@...ex.cz>, <tiwai@...e.com>
Subject: Re: [PATCH] ASoC: Intel: avs: Add null pointer check for es8366

On 2025-05-14 3:34 PM, Wentao Liang wrote:
> The avs_card_suspend_pre() and avs_card_resume_post() in es8336
> calls the snd_soc_card_get_codec_dai(), but does not check its return
> value which is a null pointer if the function fails. This can result
> in a null pointer dereference. A proper implementation can be found
> in acp5x_nau8821_hw_params() and card_suspend_pre().
> 
> Add a null pointer check for snd_soc_card_get_codec_dai() to avoid null
> pointer dereference when the function fails.
> 
> Fixes: 32e40c8d6ff9 ("ASoC: Intel: avs: Add es8336 machine board")
> Cc: stable@...r.kernel.org # v6.6
> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
> ---
>   sound/soc/intel/avs/boards/es8336.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/sound/soc/intel/avs/boards/es8336.c b/sound/soc/intel/avs/boards/es8336.c
> index 426ce37105ae..e31cc656f076 100644
> --- a/sound/soc/intel/avs/boards/es8336.c
> +++ b/sound/soc/intel/avs/boards/es8336.c
> @@ -243,6 +243,9 @@ static int avs_card_suspend_pre(struct snd_soc_card *card)
>   {
>   	struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, ES8336_CODEC_DAI);
>   
> +	if (!codec_dai)
> +		return -EINVAL;
> +
>   	return snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
>   }
>   
> @@ -251,6 +254,9 @@ static int avs_card_resume_post(struct snd_soc_card *card)
>   	struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, ES8336_CODEC_DAI);
>   	struct avs_card_drvdata *data = snd_soc_card_get_drvdata(card);
>   
> +	if (!codec_dai)
> +		return -EINVAL;
> +
>   	return snd_soc_component_set_jack(codec_dai->component, &data->jack, NULL);
>   }

Hi Wentao,

Thank you for the contribution but we do not NULL-check the result of 
snd_soc_card_get_codec_dai() wrapper. The machine board driver (also 
called sound card driver) never reaches this area if all the CPU and 
CODEC DAIs haven't been previously accounted for and verified. Flooding 
sound/soc/ with such checks is a waste of LOCs.

NACK

Kind regards,
Czarek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ