lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251119101116.78676-1-imntjempty@163.com>
Date: Wed, 19 Nov 2025 10:11:16 +0000
From: "jempty.liang" <imntjempty@....com>
To: lgirdwood@...il.com,
	broonie@...nel.org,
	perex@...ex.cz
Cc: linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"jempty.liang" <imntjempty@....com>
Subject: [PATCH] ASoC: soc-core: Pre-check zero CPU/codec DAIs, handle early rtd->dais alloc failure

This commit adds a pre-check in ASoC to ensure there are non-zero CPU or
codec DAIs. It also handles early failure of memory allocation for
rtd->dais by going to the cleanup path, preventing potential issues
from invalid configurations or out-of-memory situations.

Signed-off-by: jempty.liang <imntjempty@....com>
---
 sound/soc/soc-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4297cc27005c..e4b21bf39e59 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -545,6 +545,11 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
 	dev_set_drvdata(dev, rtd);
 	INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
 
+	if ((dai_link->num_cpus + dai_link->num_codecs) == 0) {
+		dev_err(dev, "ASoC: it has no CPU or codec DAIs\n");
+		goto free_rtd;
+	}
+
 	/*
 	 * for rtd->dais
 	 */
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ