]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: sdw_utils: Check speaker component string allocation
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Tue, 12 May 2026 14:03:53 +0000 (11:03 -0300)
committerMark Brown <broonie@kernel.org>
Thu, 14 May 2026 00:49:31 +0000 (09:49 +0900)
commit5a30862dec5a70da0a9d259de3f87a7542cc95b2
tree1180ca083ff29e0731bb44851d7662602297e1e4
parent8b7c5cc7f6e655087164eb902131de356f6d5984
ASoC: sdw_utils: Check speaker component string allocation

devm_kasprintf() can fail while building the temporary speaker
component string. If that happens, spk_components is set to NULL, but
the current code can still pass it to strlen() on a later loop iteration
or after the loop when appending the speaker component list to
card->components.

Use NULL to represent the initial "no speaker components" state, and
return -ENOMEM immediately if building spk_components fails.

Fixes: 0f60ecffbfe3 ("ASoC: sdw_utils: generate combined spk components string")
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260512-asoc-sdw-utils-spk-components-alloc-v1-1-c9bbd6d2e123@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdw_utils/soc_sdw_utils.c