Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp831675pxu; Mon, 23 Nov 2020 05:25:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxM+pjmOVPO22ThT3qiTc5DK0ujkFHaqsjkWVtUZqG6eZ0Wufo58D7k3yjd0sPAVTuuKyw0 X-Received: by 2002:aa7:c049:: with SMTP id k9mr5142419edo.49.1606137934740; Mon, 23 Nov 2020 05:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606137934; cv=none; d=google.com; s=arc-20160816; b=F5AdFFFqctG7adQM+cJFKyHxdOFSs0n4n7Hf9fiz3g4tAq96NljfQj8TqGs2diBtQX 4Lu9giuwX3ICrn8g+hcCszDjumOh9gkPSrulfaRu+kPHxUARS/btJ2Scn156snuLjVkx IeVt3zOgXPlkIr22LaFBt0+BAwsc4xedbA/0h6vnFgW4UFIXq2MC7u++Eob9i/HfYc8E gvx2EUUr9gB7Na8I++ZQ1gpflpGkW67det8dxpjBe0pcMSFjHX8BnePGW6oLlYBlDZsH sQK8P+8mlr2fG98uP4Nt0FZqPRZcDfP+wkUPqxifthy2HaA4FUaLZcQTUUU5Y9lr4mnT G2WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SAoaQzNS2DvtOqnf6kH69tcz0+aVxB+9Lj4OKoKD9bw=; b=o7PJmiDUWCBmVPmosCSKcuPxE8uyZ9aM2CCzGW3bf+TrhmqPEjXFe7seMar8zD4Ioa m4QoRNb4UyJNgF4lj3wLOXtPQF/Fa8/OI41ARpQ/jGALzfnbWztNu2CclQd+J/cZjDRR RGrEPmd8TR/LuGtvnn1CpmxqUXjbRFNbaHgbmhieQi1dQ4Z8q33vHHj4p9tsVsREvZn/ 74ZAsm096QeRpWXucqjkHOmOEfxaQtDEbaRpcnMhGrCXcI1sXaPw9GDUYhOj+JcSebra ZORVamvbHKlT14uVofdAuP/KmLE7QNn398POYIfLXrudS0eMP1zc1/91pOjELypR1Zti IufQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zzwf782s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dx6si6429145ejb.698.2020.11.23.05.25.10; Mon, 23 Nov 2020 05:25:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zzwf782s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388892AbgKWNV2 (ORCPT + 99 others); Mon, 23 Nov 2020 08:21:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:50406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732022AbgKWMhy (ORCPT ); Mon, 23 Nov 2020 07:37:54 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C36D20721; Mon, 23 Nov 2020 12:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135073; bh=dKkCF0eo92s5dRaLsiofgW2ogBbvSLH3PZZi5Ejhj4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zzwf782sLwI4+oT4FvVG92fCiasJI1pXYWppbvNq9cUAW1+rPohBwZKyRcNC7grsx /fwNFP8GNNHl8NINQqkqzssxIyLU2zPutBzyc58FPn9qn5aZ1bxRO4zoUmfvBPIqOO x6yh+BH6dJ2criN6JnwFvjRLlAaWsuu+ZiILc2F8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , V Sujith Kumar Reddy , Srinivasa Rao Mandadapu , Mark Brown , Sasha Levin Subject: [PATCH 5.4 088/158] ASoC: qcom: lpass-platform: Fix memory leak Date: Mon, 23 Nov 2020 13:21:56 +0100 Message-Id: <20201123121824.180055724@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivasa Rao Mandadapu [ Upstream commit bd6327fda2f3ded85b69b3c3125c99aaa51c7881 ] lpass_pcm_data is not freed in error paths. Free it in error paths to avoid memory leak. Fixes: 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage") Signed-off-by: Pavel Machek Signed-off-by: V Sujith Kumar Reddy Signed-off-by: Srinivasa Rao Mandadapu Link: https://lore.kernel.org/r/1605416210-14530-1-git-send-email-srivasam@codeaurora.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/qcom/lpass-platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index 9acaef81dd74c..b1981d84ac18c 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -73,8 +73,10 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) else dma_ch = 0; - if (dma_ch < 0) + if (dma_ch < 0) { + kfree(data); return dma_ch; + } drvdata->substream[dma_ch] = substream; @@ -95,6 +97,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); if (ret < 0) { + kfree(data); dev_err(soc_runtime->dev, "setting constraints failed: %d\n", ret); return -EINVAL; -- 2.27.0