Skip to content

Commit 3b61732

Browse files
simontrimmeredoardocanepa
authored andcommitted
spi: cs42l43: Property entry should be a null-terminated array
BugLink: https://bugs.launchpad.net/bugs/2126463 [ Upstream commit ffcfd071eec7973e58c4ffff7da4cb0e9ca7b667 ] The software node does not specify a count of property entries, so the array must be null-terminated. When unterminated, this can lead to a fault in the downstream cs35l56 amplifier driver, because the node parse walks off the end of the array into unknown memory. Fixes: 0ca645a ("spi: cs42l43: Add speaker id support to the bridge configuration") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220371 Signed-off-by: Simon Trimmer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Edoardo Canepa <[email protected]>
1 parent 84fa8fc commit 3b61732

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-cs42l43.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static struct spi_board_info *cs42l43_create_bridge_amp(struct cs42l43_spi *priv
293293
struct spi_board_info *info;
294294

295295
if (spkid >= 0) {
296-
props = devm_kmalloc(priv->dev, sizeof(*props), GFP_KERNEL);
296+
props = devm_kcalloc(priv->dev, 2, sizeof(*props), GFP_KERNEL);
297297
if (!props)
298298
return NULL;
299299

0 commit comments

Comments
 (0)