Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2267049pxb; Sat, 14 Nov 2020 21:08:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmx5/JKwrDe4xZL1P0A1KkGacmnPpCe7SGPLUhmPpnURNNvTIJ7YIqJPdS9DBuZk0MjhHH X-Received: by 2002:a17:906:1497:: with SMTP id x23mr8785859ejc.453.1605416906886; Sat, 14 Nov 2020 21:08:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605416906; cv=none; d=google.com; s=arc-20160816; b=vSf119xce0f0MbZ2l9Vv+D2l3E5o69PgcUfjgpNp/WtihVIz1rpvRUtMucRWvGNYqi pE0/Mp2eBENgrQuMuobuqwRPzZZ0rMUbNqXYGDbbf8HqHr2GsrRvoA1lsw9tmB+Q1HnS yr647Q6wt4VjSeIPf8sjjWYxWdUqD6u8CYSps7B05RaMu2pgvp8W3rtYcS8AE8QH3yGR Ercd4fCZfLYOA9rBElFajKVyHqGgy3eYkh+THpGzDuuhy5fKnfDQrRcmqUFns+ot/hHU +N/iIkYgiOjqgnFY9Q3vufCffxbZyq6zW5VpdXtJjhROHrDuLpS5tGOEzaXAI6C5z5tD 9gig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=DHZQrIgHGobEqfrhC8jO9oXKDIMrd9L7WeOf8QdR/wg=; b=uOpwQyGUZrj7OP+Ld6MoTs+dGcOI+oB/KNYq/ny5HNj79ICM315rKeWrdB8mJhpdDT HvodL7rj2QpgSwjFcrmHnuqQwqa5DgD0giIpr2SqyugpJjjvn+gkhw6Pp6dtYK6rDJxo EvaQ2vK3/j+3hDOLxDt8V7CU5zoEKafIQtOF4aVoF25ObI/unbGYoDhf02abqgHxoC19 c98gpcP2tlofEfiIs+K3ouBPKnmQkQ1U5avJ58cjKcyZxvqPcIfKDI26ET9KFCnQwk6j rADaXeVtddN5AWrHFXWxesuzofzjtrMsVZGEYU38OEhOtudNIG16tqrmWIpFnZp3Fuze wKwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=r9tvNCFv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj7si8950174ejb.254.2020.11.14.21.08.03; Sat, 14 Nov 2020 21:08:26 -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=@mg.codeaurora.org header.s=smtp header.b=r9tvNCFv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbgKOE5c (ORCPT + 99 others); Sat, 14 Nov 2020 23:57:32 -0500 Received: from m42-4.mailgun.net ([69.72.42.4]:59788 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbgKOE5W (ORCPT ); Sat, 14 Nov 2020 23:57:22 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605416242; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=DHZQrIgHGobEqfrhC8jO9oXKDIMrd9L7WeOf8QdR/wg=; b=r9tvNCFvETQyQv6biXlmgH32/+pHyuam90NRLSYbTA4ado28uZU+T4RCwSPQ/Ydfli3dPRgg CLLXgR/Sr+1pVUYM5qHcImMaQh7zNKBuM54QT4w2oUV+rGAjjdc7/58Akh3VX6aRouTqSUy+ 4dsTl+3egnDxPHJN4d1EHik5WyA= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 5fb0b52937ede2253b5b654d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sun, 15 Nov 2020 04:57:13 GMT Sender: srivasam=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6C88FC43464; Sun, 15 Nov 2020 04:57:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from hyd-lnxbld210.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srivasam) by smtp.codeaurora.org (Postfix) with ESMTPSA id DB9F2C433C6; Sun, 15 Nov 2020 04:57:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DB9F2C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=srivasam@codeaurora.org From: Srinivasa Rao Mandadapu To: agross@kernel.org, bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, srinivas.kandagatla@linaro.org, rohitkr@codeaurora.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Srinivasa Rao Mandadapu , Pavel Machek , V Sujith Kumar Reddy Subject: [PATCH] Asoc: qcom: lpass-platform: Fix memory leak Date: Sun, 15 Nov 2020 10:26:50 +0530 Message-Id: <1605416210-14530-1-git-send-email-srivasam@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 36d1512..7a3fdf8 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -122,8 +122,10 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component, else dma_ch = 0; - if (dma_ch < 0) + if (dma_ch < 0) { + kfree(data); return dma_ch; + } if (cpu_dai->driver->id == LPASS_DP_RX) { map = drvdata->hdmiif_map; @@ -147,6 +149,7 @@ static int lpass_platform_pcmops_open(struct snd_soc_component *component, 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; -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.