[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250610103225.1475-2-thorsten.blum@linux.dev>
Date: Tue, 10 Jun 2025 12:32:16 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.dev>,
Vijendar Mukunda <Vijendar.Mukunda@....com>,
Péter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Charles Keepax <ckeepax@...nsource.cirrus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>,
Peter Zijlstra <peterz@...radead.org>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
stable@...r.kernel.org,
Liam Girdwood <liam.r.girdwood@...el.com>,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: sdw_utils: Fix potential NULL pointer deref in is_sdca_endpoint_present()
Check the return value of kzalloc() and exit early to avoid a potential
NULL pointer dereference.
Cc: stable@...r.kernel.org
Fixes: 4f8ef33dd44a ("ASoC: soc_sdw_utils: skip the endpoint that doesn't present")
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
sound/soc/sdw_utils/soc_sdw_utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index 30f84f4e7637..b70cb3793d8f 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -1180,6 +1180,8 @@ static int is_sdca_endpoint_present(struct device *dev,
int i;
dlc = kzalloc(sizeof(*dlc), GFP_KERNEL);
+ if (!dlc)
+ return -ENOMEM;
adr_end = &adr_dev->endpoints[end_index];
dai_info = &codec_info->dais[adr_end->num];
--
2.49.0
Powered by blists - more mailing lists