]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 9 Oct 2021 06:58:40 +0000 (14:58 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 11 Oct 2021 12:19:14 +0000 (13:19 +0100)
commitc448b7aa3e66042fc0f849d9a0fb90d1af82e948
tree5f47d2b04859c2a87af2261623b7fa2a7243cf88
parent214174d9f56c7f81f4860a26b6b8b961a6b92654
ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()

'component' is allocated in snd_soc_register_component(), but component->list
is not initalized, this may cause snd_soc_del_component_unlocked() deref null
ptr in the error handing case.

KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:__list_del_entry_valid+0x81/0xf0
Call Trace:
 snd_soc_del_component_unlocked+0x69/0x1b0 [snd_soc_core]
 snd_soc_add_component.cold+0x54/0x6c [snd_soc_core]
 snd_soc_register_component+0x70/0x90 [snd_soc_core]
 devm_snd_soc_register_component+0x5e/0xd0 [snd_soc_core]
 tas2552_probe+0x265/0x320 [snd_soc_tas2552]
 ? tas2552_component_probe+0x1e0/0x1e0 [snd_soc_tas2552]
 i2c_device_probe+0xa31/0xbe0

Fix by adding INIT_LIST_HEAD() to snd_soc_component_initialize().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211009065840.3196239-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c