From patchwork Tue Oct 27 13:48:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E10CC55179 for ; Tue, 27 Oct 2020 14:02:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67ECC22264 for ; Tue, 27 Oct 2020 14:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807377; bh=yqYcts3DrR9mIw3ISZq5NxZ9D9mQTVHAfxq8OYt1alM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=I0Q169iay7BmV7hOHcXfcYKM0KAZqdqgC6mMLORtzHEcmQ5F/xHkdgLvYh2wPg96q YN+A6qDa96nt5Ej13Uq7O74OrL24MsHZWZgKtdq5AvYHF21Sto9in2UpmOYNO7M4X6 /t7zXqXDM8LY+MOtQ7crojoSjA/vW7ATpARV50/0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753910AbgJ0OCz (ORCPT ); Tue, 27 Oct 2020 10:02:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:50964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753906AbgJ0OCy (ORCPT ); Tue, 27 Oct 2020 10:02:54 -0400 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 B0D9222258; Tue, 27 Oct 2020 14:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807374; bh=yqYcts3DrR9mIw3ISZq5NxZ9D9mQTVHAfxq8OYt1alM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ALi26JYzXjvIJOG1KbT+rDsRbsk7CpobxyAx0QkwsxFkYFs+gPwEuZ6kvGhz2LPnn WYlSgkW+V7w2E+zSAI0oAVKHz7IS4vtMilf2vgPGYX+q/npKvZHiZfgpDYH+w/KUqz VQ36kFTDMmIJ/YJNMSPDKtKc85OfsNxAftZXWA3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rohit kumar , Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 4.9 029/139] ASoC: qcom: lpass-platform: fix memory leak Date: Tue, 27 Oct 2020 14:48:43 +0100 Message-Id: <20201027134903.512482209@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rohit kumar [ Upstream commit 5fd188215d4eb52703600d8986b22311099a5940 ] lpass_pcm_data is never freed. Free it in close ops to avoid memory leak. Fixes: 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage") Signed-off-by: Rohit kumar Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/1597402388-14112-5-git-send-email-rohitkr@codeaurora.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/qcom/lpass-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index 420d200f9a053..eeed53cf325ac 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -68,7 +68,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) int ret, dma_ch, dir = substream->stream; struct lpass_pcm_data *data; - data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -140,6 +140,7 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream) if (v->free_dma_channel) v->free_dma_channel(drvdata, dma_ch); + kfree(data); return 0; }