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: <a154e7eb-2708-411d-a494-868abe7052b7@linux.intel.com>
Date: Mon, 28 Apr 2025 15:38:30 +0300
From: Péter Ujfalusi <peter.ujfalusi@...ux.intel.com>
To: Kees Cook <kees@...nel.org>, Liam Girdwood <lgirdwood@...il.com>
Cc: Bard Liao <yung-chuan.liao@...ux.intel.com>,
 Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
 Daniel Baluta <daniel.baluta@....com>,
 Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
 Pierre-Louis Bossart <pierre-louis.bossart@...ux.dev>,
 Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>,
 Takashi Iwai <tiwai@...e.com>, sound-open-firmware@...a-project.org,
 linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] ASoC: SOF: ipc4-pcm: Adjust pipeline_list->pipelines
 allocation type



On 26/04/2025 09:25, Kees Cook wrote:
> In preparation for making the kmalloc family of allocators type aware,
> we need to make sure that the returned type from the allocation matches
> the type of the variable being assigned. (Before, the allocator would
> always return "void *", which can be implicitly cast to any pointer type.)
> 
> The assigned type is "struct snd_sof_pipeline **", but the returned type
> will be "struct snd_sof_widget **". These are the same size allocation
> (pointer size) but the types don't match. Adjust the allocation type to
> match the assignment.

It looks like that this is indeed an oversight and a bug introduced by a
mostly mechanical change (introduced in v6.3).

Can you add:
Fixes: 9c04363d222b ("ASoC: SOF: Introduce struct snd_sof_pipeline")

and:
Acked-by: Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>
> Signed-off-by: Kees Cook <kees@...nel.org>
> ---
> Cc: Liam Girdwood <lgirdwood@...il.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>
> Cc: Bard Liao <yung-chuan.liao@...ux.intel.com>
> Cc: Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>
> Cc: Daniel Baluta <daniel.baluta@....com>
> Cc: Kai Vehmanen <kai.vehmanen@...ux.intel.com>
> Cc: Pierre-Louis Bossart <pierre-louis.bossart@...ux.dev>
> Cc: Mark Brown <broonie@...nel.org>
> Cc: Jaroslav Kysela <perex@...ex.cz>
> Cc: Takashi Iwai <tiwai@...e.com>
> Cc: <sound-open-firmware@...a-project.org>
> Cc: <linux-sound@...r.kernel.org>
> ---
>  sound/soc/sof/ipc4-pcm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
> index 1a2841899ff5..52903503cf3b 100644
> --- a/sound/soc/sof/ipc4-pcm.c
> +++ b/sound/soc/sof/ipc4-pcm.c
> @@ -784,7 +784,8 @@ static int sof_ipc4_pcm_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
>  
>  		/* allocate memory for max number of pipeline IDs */
>  		pipeline_list->pipelines = kcalloc(ipc4_data->max_num_pipelines,
> -						   sizeof(struct snd_sof_widget *), GFP_KERNEL);
> +						   sizeof(*pipeline_list->pipelines),
> +						   GFP_KERNEL);
>  		if (!pipeline_list->pipelines) {
>  			sof_ipc4_pcm_free(sdev, spcm);
>  			return -ENOMEM;

-- 
Péter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ