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 961551420A3; Tue, 23 Jan 2024 01:07:46 +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=1705972066; cv=none; b=qfGA9buszdmKlbvy86fMrwKYt5qyiWBdSdT/yVRWJK7YbP9gsO8934Xb8tVI57QumA9/8K4IdJFxLeYLWt0TN+t8NMT/B2fM3wVn74E9pEQsYpBTxMdNKgZ0zOlcPxlPBFIYCJbYlXLnC0H5NTI7Oea32G7LtaiIn/T5+OEQ4RM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705972066; c=relaxed/simple; bh=YJKCUNKQdMVhJzV37SPlSvQTVBxI6ETTHTfVhZGEAzc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RR6DwDKVAwdA32p4EKk5eHGzr/4ZiMRKmYyRgk0vW+MasjrN8UjmStj5p5avZMTNTNY1EQJQHlwJ9E+OxWF1oobKO6PnzxU4Z/WcOnwkr/2Ur1JegD8yNEGt6/QJaL0n8Am6V5kSEPb+RfbSpJ3DUsy5O5rDMmD2u8ENMhgIBSg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lE1auZKS; 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="lE1auZKS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E38EC43394; Tue, 23 Jan 2024 01:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705972066; bh=YJKCUNKQdMVhJzV37SPlSvQTVBxI6ETTHTfVhZGEAzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lE1auZKSIgM7gWse0gDBMQfs6qavMOdhBKHOSAIGMkS7YH8tIAsIxuekw4aFdw3al 8FBYlmsbEDxDWTO3z6cTB89601NMnRPEaOKU6GvvIjc3nY39G0zsyY2+L764vCZ1Ph 1bOaC20Yy+weJTC16EP9l7yMZt+b64tpTAkTNJ6E= 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.15 010/374] ASoC: Intel: Skylake: Fix mem leak in few functions Date: Mon, 22 Jan 2024 15:54:26 -0800 Message-ID: <20240122235744.985260682@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235744.598274724@linuxfoundation.org> References: <20240122235744.598274724@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-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 db41bd717065..0d08b0269a66 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -251,8 +251,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 7a425271b08b..fd9624ad5f72 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