From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8086C4167B for ; Mon, 11 Dec 2023 14:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344248AbjLKOEf (ORCPT ); Mon, 11 Dec 2023 09:04:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344135AbjLKODv (ORCPT ); Mon, 11 Dec 2023 09:03:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A73CA2129 for ; Mon, 11 Dec 2023 06:02:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F610C433C8; Mon, 11 Dec 2023 14:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702303344; bh=xj32oWQwQcPe3Qc5l25cuHLZaqv2Ze1B4OZ/kgGDhZ0=; h=From:To:Cc:Subject:Date:From; b=rSjOTqszrlN/prQudnZii7KuexICWL95Etivt6tF8w5OzlQ9O5TB3IyhNspeLUfrY ObaW9XlpNAWBcblz30ki01Ej28U7t1VkAeBV7z5L8wsZYw48RPEm8ltpW4kgCGokbv AGpDlioc4diGHoNs3NBW1NfDSCr9PM2Pfs/gJZpYFUw5YMv6/BRC6CE9oVv1DZedw9 ViKYMsDwP56pxubqoGw8CuaPfpK75d07rbaeaIBtItCM0h+fiQ9sG+swShYFdzgBQs 1YeSgVYlHF/Hnt9ufK7MVtBT1ElFiZlPFWV0kiF2rjtogUK9BmcnOuafc1qKGk+cI/ orOhtHaW2y+HQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kamil Duljas , =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Mark Brown , Sasha Levin , cezary.rojewski@intel.com, pierre-louis.bossart@linux.intel.com, liam.r.girdwood@linux.intel.com, peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, perex@perex.cz, tiwai@suse.com, zhangyiqun@phytium.com.cn, kuninori.morimoto.gx@renesas.com, suhui@nfschina.com, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 01/12] ASoC: Intel: Skylake: Fix mem leak in few functions Date: Mon, 11 Dec 2023 09:01:54 -0500 Message-ID: <20231211140219.392379-1-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.263 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kamil Duljas [ Upstream commit d5c65be34df73fa01ed05611aafb73b440d89e29 ] The resources should be freed when function return error. Signed-off-by: Kamil Duljas Reviewed-by: Amadeusz Sławiński Link: https://lore.kernel.org/r/20231116125150.1436-1-kamil.duljas@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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