Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3390368lkq; Mon, 23 Nov 2020 04:36:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyW8WjBmDjpNkM2FBwd/x03ipggLiv1Lw3WEXjXekgazmK8+0HGKVDAgMX5V3PBJSg5M5v8 X-Received: by 2002:a17:906:594a:: with SMTP id g10mr23599282ejr.448.1606134997655; Mon, 23 Nov 2020 04:36:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606134997; cv=none; d=google.com; s=arc-20160816; b=dZ/oWO5kLOCGCr4SC8Hp4TGFmqBZenKUrSjJiIXVqkOUTBNZaOzcMGInVuW9VMjpaU NSIpBYexPivB8zn69J0pm7KNjBeWw9fJQL+JaTRSfHidUbazRB6Msbfxf/2AEfKwT+6K jf4AfjLy0IyLGxOJvfiwMIFwt5iocT7cf0+ctUl+2QsfivvrP7OM42l5ExPXirLrWIja tz4XI0oxm8zvNqg6jnfh8ecEsIZvEluxJM7h5MlfTrbIwwJCj1/wF9EG8OHYQdOfZcmx S4Eohco+EWAIhgZmIqDFgPz95HgiNBLm54CCoQazCQ9KK0sqMZSdQ6hw1M1tJcGOkl0V whsw== 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=dsgxIWIpbnlZD96qLxKeNV8IR7mK+8S293vlkVyx+Hw=; b=OD+X3Tr+YPYcwBUi4D88B78RoSIu2dZDlrbox0fN/vzv1YWcCBmJ+Y5WBdb1YYHc2w QhvtwRHtEuMnvAu4RwB09kun8VjFJ42TYfP6gVVVOSqnqOI6vaa3pl0nvZYh4xRe/s5r LtA+2Qv/pGJ1XMAjgGQiG01S70BljQIpiD419UgmyZJDt7abRl4buyKnlwSpBsC/O1Fn LZVDEQ19w+NLcrn0poYoo5foqeIAmipok6V8va6PU5d5O7F9xjhlJYDWi2HjJXhFcXzw TE66b7TIyf2MEtkDMGnYz1J89XyJvHp27HuQLvByoVPAUFsoUkMiJPbwhUr2lqDQPuZN cK2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o6waMkF5; 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 z90si6056355ede.587.2020.11.23.04.36.14; Mon, 23 Nov 2020 04:36:37 -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=o6waMkF5; 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 S1731055AbgKWMcU (ORCPT + 99 others); Mon, 23 Nov 2020 07:32:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:43038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730977AbgKWMbx (ORCPT ); Mon, 23 Nov 2020 07:31:53 -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 90F62208C3; Mon, 23 Nov 2020 12:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134713; bh=Kxkbz6p5C8ddsZHzcx9DhxBj5YlWHjwKKCXZG2Rjsvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o6waMkF5UmZtUJuMcw8F0832JaXnxYBWe30C1JCb87rawYI5jo4RUNHvkBsb62Ufw jHi8+9xKMMyJGv+blZIsA9xWbaOqPHKCR1cwSEvNLrI98Z95FsHBHdd6u2HRiIKD3m CdnA2XMTd0pzDldjY+s4MzMVxp4puBjEp3ToGdbA= 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 4.19 55/91] ASoC: qcom: lpass-platform: Fix memory leak Date: Mon, 23 Nov 2020 13:22:15 +0100 Message-Id: <20201123121811.998040731@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 2f29672477892..1d06e2b7bb635 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -81,8 +81,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; @@ -103,6 +105,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