diff options
| author | Chen-Yu Tsai <[email protected]> | 2025-05-16 05:05:48 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2025-05-16 11:18:15 +0000 |
| commit | 628479afc7a157bca3430a75e759ed06c1a81c66 (patch) | |
| tree | d9dbc007ef5950ecfe3c450cb3899847901132fc /rust/helpers/task.c | |
| parent | ASoC: mediatek: mt8183-afe-pcm: Shorten source code (diff) | |
| download | kernel-628479afc7a157bca3430a75e759ed06c1a81c66.tar.gz kernel-628479afc7a157bca3430a75e759ed06c1a81c66.zip | |
ASoC: soc-utils: Check string pointer validity in snd_soc_dlc_is_dummy()
In the recently added snd_soc_dlc_is_dummy(), the helper uses the .name
and .dai_name fields without checking their validity.
For .name, this field is NULL if the component is matched by .of_node
instead. In fact, only one of these fields may be set. This caused a
NULL pointer dereference on MediaTek MT8195 and MT8188 platforms with
the subsequent conversion to snd_soc_dlc_is_dummy() in their machine
drivers. The codecs are all matches through the device tree, so their
.name fields are empty.
For .dai_name, there are cases where this field is empty, such as for
the following component definitions:
#define COMP_EMPTY() { }
#define COMP_PLATFORM(_name) { .name = _name }
#define COMP_AUX(_name) { .name = _name }
#define COMP_CODEC_CONF(_name) { .name = _name }
Or the single link CPU DAI case in the simple audio card family, as
covered by simple_util_canonicalize_cpu(), in which the .dai_name
field is explicitly cleared.
To fix this, check the validity of the fields before using them in
string comparison.
Fixes: 3e021f3b8115 ("ASoC: soc-utils: add snd_soc_dlc_is_dummy()")
Cc: Kuninori Morimoto <[email protected]>
Signed-off-by: Chen-Yu Tsai <[email protected]>
Acked-by: Kuninori Morimoto <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'rust/helpers/task.c')
0 files changed, 0 insertions, 0 deletions
