All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 01/13] ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()
@ 2021-10-25 17:00 ` Sasha Levin
  0 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2021-10-25 17:00 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yang Yingliang, Hulk Robot, Mark Brown, Sasha Levin, lgirdwood,
	perex, tiwai, alsa-devel

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit c448b7aa3e66042fc0f849d9a0fb90d1af82e948 ]

'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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e677422c1058..133296596864 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2454,6 +2454,7 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
 	INIT_LIST_HEAD(&component->dai_list);
 	INIT_LIST_HEAD(&component->dobj_list);
 	INIT_LIST_HEAD(&component->card_list);
+	INIT_LIST_HEAD(&component->list);
 	mutex_init(&component->io_mutex);
 
 	component->name = fmt_single_name(dev, &component->id);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-10-25 17:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 17:00 [PATCH AUTOSEL 5.10 01/13] ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked() Sasha Levin
2021-10-25 17:00 ` Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 02/13] scsi: core: Put LLD module refcnt after SCSI device is released Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 03/13] ALSA: hda/realtek: Fixes HP Spectre x360 15-eb1xxx speakers Sasha Levin
2021-10-25 17:00   ` Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 04/13] cavium: Return negative value when pci_alloc_irq_vectors() fails Sasha Levin
2021-10-25 17:00   ` Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 05/13] scsi: qla2xxx: Return -ENOMEM if kzalloc() fails Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 06/13] scsi: qla2xxx: Fix unmap of already freed sgl Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 07/13] mISDN: Fix return values of the probe function Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 08/13] cavium: " Sasha Levin
2021-10-25 17:00   ` Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 09/13] vrf: Revert "Reset skb conntrack connection..." Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 10/13] sfc: Export fibre-specific supported link modes Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 11/13] sfc: Don't use netif_info before net_device setup Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 12/13] usbnet: sanity check for maxpacket Sasha Levin
2021-10-25 17:00 ` [PATCH AUTOSEL 5.10 13/13] hyperv/vmbus: include linux/bitops.h Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.