Skip to content

Commit 44a10b4

Browse files
charleskeepaxmehmetb0
authored andcommitted
ASoC: Intel: sof_sdw: Add space for a terminator into DAIs array
BugLink: https://bugs.launchpad.net/bugs/2097332 [ Upstream commit 255cc58 ] The code uses the initialised member of the asoc_sdw_dailink struct to determine if a member of the array is in use. However in the case the array is completely full this will lead to an access 1 past the end of the array, expand the array by one entry to include a space for a terminator. Fixes: 27fd36a ("ASoC: Intel: sof-sdw: Add new code for parsing the snd_soc_acpi structs") Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]> CVE-2024-57880 Signed-off-by: Koichiro Den <[email protected]>
1 parent d2aa7e0 commit 44a10b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sound/soc/intel/boards/sof_sdw.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,8 +1995,12 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
19951995
return ret;
19961996
}
19971997

1998-
/* One per DAI link, worst case is a DAI link for every endpoint */
1999-
sof_dais = kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL);
1998+
/*
1999+
* One per DAI link, worst case is a DAI link for every endpoint, also
2000+
* add one additional to act as a terminator such that code can iterate
2001+
* until it hits an uninitialised DAI.
2002+
*/
2003+
sof_dais = kcalloc(num_ends + 1, sizeof(*sof_dais), GFP_KERNEL);
20002004
if (!sof_dais)
20012005
return -ENOMEM;
20022006

0 commit comments

Comments
 (0)