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 024DC60DF0; Tue, 23 Jan 2024 00:45:39 +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=1705970740; cv=none; b=Yyko1BJuOkjqaL2BGl80nQD/6k6T+O9/H0tyNelFzvEkLxLKJaHdtSwWmdj9TAugbkY5IoPUJHn9sTjY0lVkl98Sp4aTa/wrSz20iYvYBkuiWt3mSFk/OT0rUR40h5dHGkxja1sk+dmV5wVUl4H7dRiJ2rzwIo+NBbqeeRgAdwU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705970740; c=relaxed/simple; bh=ZVwpz2qMN/Bw6EhrboiH9PA+iF4yGu/rgalXI0X5VlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uJz/Y3xpqKeB3fQSiSLVLFIYUF+5xbADIPPEKZPTyLHO5qCOlOg6fSl1Bj48cpRdE0sZlxKiCqFV4js1N3nazcFAkn2MboLTbCKAOtYuIrgIFRc4Gve9Fd69Y81JgsZ+2on/Y39PT/cV8EDkRXMuOxrUwxKM2NC0I70F+VBsaSI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q1Tj867i; 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="q1Tj867i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A2A4C433F1; Tue, 23 Jan 2024 00:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705970739; bh=ZVwpz2qMN/Bw6EhrboiH9PA+iF4yGu/rgalXI0X5VlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q1Tj867i3PuiKYPWslvfV92DDCv+jB7KrsR+63+XJS3sZCt7z7idwvzaiZIxwecE/ pA/z7ksr9I8xydHYZLKr9le40nyU9H+LB++nu5tYoI2rJ7ADrZlC6AZEjyEwmorhQe gA7guDUenUZ73eGz5/haBGpOx4YbSLv7rYtb7Ypo= 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.10 009/286] ASoC: Intel: Skylake: Fix mem leak in few functions Date: Mon, 22 Jan 2024 15:55:15 -0800 Message-ID: <20240122235732.365343408@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235732.009174833@linuxfoundation.org> References: <20240122235732.009174833@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.10-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 b531d9dfc2d6..c7e76111f68b 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