From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0793129A74; Tue, 23 Jan 2024 00:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968720; cv=none; b=i9MAMqQNwebtCGhjRGJXFxrCSX+DzT1Z5BnbQbf7A8jgw5dpUTSI0SgvvFGQZVMvM38nVjCzsULg9W+xbD2iGcqiVWk1SD1ItxPsQ/wTniXZDEumaAKiV3kcLIqjzLQIgTFAdsxtfMTI+Iz/8acoYFmFxy+8RclaRigmUGBPdQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968720; c=relaxed/simple; bh=vI2lx9x4OVJkXh3NHMkHjxToUH2Dx+OPAF9za9PAKNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ube3q/uJ2USA1Qy/xCxkPHDZUNPGgPpoIRo9vUv2Knsn/i0l2v7wRF/bEnbWwtiI+DLlQo2CNNhg0Yu7bcJ7AaY25R/qFwnvMEgD6DsYnB6y7DjChU95gIKWxZ5kLq54F7h77VIIVf1V+ddByoGDyX6KyArwxy7TOEEnrkNMpCA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dRJ5hvGw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dRJ5hvGw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0F7EC433C7; Tue, 23 Jan 2024 00:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705968719; bh=vI2lx9x4OVJkXh3NHMkHjxToUH2Dx+OPAF9za9PAKNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRJ5hvGwPEMfmv0hnlHfYnniDEC2cU9b30V3yRbfcbUCKCdPDh4FcRIu/PjnJcXEg +FXx3VaPWj5/fEkcegR6CSwvmajshu7NZBC+1QqunvnUjNDjxwcdlgot8btBWwEdQg A6PalMbQH9+n9yLqhY+gmdh8A29C2AmungrENX78= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kamil Duljas , =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Mark Brown , Sasha Levin Subject: [PATCH 5.4 004/194] ASoC: Intel: Skylake: Fix mem leak in few functions Date: Mon, 22 Jan 2024 15:55:34 -0800 Message-ID: <20240122235719.398763744@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235719.206965081@linuxfoundation.org> References: <20240122235719.206965081@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ 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 439dd4ba690c..19176ae27274 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 667cdddc289f..7286cbd0c46f 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.43.0