public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.4 01/12] ASoC: Intel: Skylake: Fix mem leak in few functions
@ 2023-12-11 14:01 Sasha Levin
  2023-12-11 14:01 ` [PATCH AUTOSEL 5.4 02/12] ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16 Sasha Levin
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Sasha Levin @ 2023-12-11 14:01 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kamil Duljas, Amadeusz Sławiński, Mark Brown,
	Sasha Levin, cezary.rojewski, pierre-louis.bossart,
	liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, perex, tiwai, zhangyiqun,
	kuninori.morimoto.gx, suhui, alsa-devel, linux-sound

From: Kamil Duljas <kamil.duljas@gmail.com>

[ Upstream commit d5c65be34df73fa01ed05611aafb73b440d89e29 ]

The resources should be freed when function return error.

Signed-off-by: Kamil Duljas <kamil.duljas@gmail.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20231116125150.1436-1-kamil.duljas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c     | 4 +++-
 sound/soc/intel/skylake/skl-sst-ipc.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 439dd4ba690c4..19176ae272742 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -260,8 +260,10 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
 	snd_pcm_set_sync(substream);
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
-	if (!mconfig)
+	if (!mconfig) {
+		kfree(dma_params);
 		return -EINVAL;
+	}
 
 	skl_tplg_d0i3_get(skl, mconfig->d0i3_caps);
 
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 667cdddc289fd..7286cbd0c46f9 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -1003,8 +1003,10 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
 
 	reply.size = (reply.header >> 32) & IPC_DATA_OFFSET_SZ_MASK;
 	buf = krealloc(reply.data, reply.size, GFP_KERNEL);
-	if (!buf)
+	if (!buf) {
+		kfree(reply.data);
 		return -ENOMEM;
+	}
 	*payload = buf;
 	*bytes = reply.size;
 
-- 
2.42.0


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

end of thread, other threads:[~2023-12-11 14:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 14:01 [PATCH AUTOSEL 5.4 01/12] ASoC: Intel: Skylake: Fix mem leak in few functions Sasha Levin
2023-12-11 14:01 ` [PATCH AUTOSEL 5.4 02/12] ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16 Sasha Levin
2023-12-11 14:01 ` [PATCH AUTOSEL 5.4 03/12] ASoC: Intel: Skylake: mem leak in skl register function Sasha Levin
2023-12-11 14:01 ` [PATCH AUTOSEL 5.4 04/12] ASoC: cs43130: Fix the position of const qualifier Sasha Levin
2023-12-11 14:01 ` [PATCH AUTOSEL 5.4 05/12] ASoC: cs43130: Fix incorrect frame delay configuration Sasha Levin
2023-12-11 14:01 ` [PATCH AUTOSEL 5.4 06/12] ASoC: rt5650: add mutex to avoid the jack detection failure Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 5.4 07/12] nouveau/tu102: flush all pdbs on vmm flush Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 5.4 08/12] net/tg3: fix race condition in tg3_reset_task() Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 5.4 09/12] ASoC: da7219: Support low DC impedance headset Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 5.4 10/12] nvme: introduce helper function to get ctrl state Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 5.4 11/12] drm/exynos: fix a potential error pointer dereference Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 5.4 12/12] drm/exynos: fix a wrong error checking Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox