Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5221203ybl; Tue, 27 Aug 2019 01:02:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0wIYlGrOGDFqlK6z9Js03FSg4xsDgZWT3gxgyZ19zYN0Ix+UDaHDkcQ/fmrMG7JOtmG6B X-Received: by 2002:a63:2b8e:: with SMTP id r136mr20052082pgr.216.1566892948909; Tue, 27 Aug 2019 01:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892948; cv=none; d=google.com; s=arc-20160816; b=v32tTRhjruJ6DNBYl9L6nSA/dp5aluI/IjCs8bIpxQX34smoYthbOsxccxvvh/C2rJ tZ5IRen9fXPWmm5p2yDik0sfdXwGJxkLQc/oLonBhOK6br0q2IZcu1Njvu8sAUPg7cNa krV/evwSZrWy/a1fQpY7u038NR1g9E8TOUP1RnMvWn37jECtiV7/0QAYN2d3oY3/AaCd giGiwT360/r5ztSKjL2y+4dXH0GzA/fTf6QI/at/D2fdtD5L14hJIdyEHykFLyZS+pWd 3huZoiQXGsOVrYzuDl0+MKcTs8mE4+Q0IU0EprVmACVF88GtaVIdubZbAXKTWvDmEWlJ O+8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GX398brenyN7FQZYCCL29Xf+ruSm7c9qwS3N1upzMYU=; b=WWI+pdGhIqwUsAYWLXVZoBbAyc8l0vzTBvgXDxK3JXkc7bzZCZ1BDHruo5s6WFV6vz zGO8SD/nfDcEnRDHT66QmLFdU3LaoknBbXpJB+XqMIDf/459eLHjYoAyTHjVX3KzfxCa TFq2xQwxl8KfAAE13d6aVAfmaKXLDgVEE5CiTKj8JFQ2uxzZF1zmapFbuyGpjGIol2Db 3LnqTfi3Tg0kfM8UZ0IXvUhPdRiCXUUYkDyq1jUZHFKYr3qsHLa18ydBUQMLXuZVToRm Xu9q6jJdw0UAbkERMxkzRx+s+CvKs5WuSkIyek7gcJvH6d/3cFfWEyYNffd23u0JLuBu n8tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0dl0qgto; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si11063487pgl.323.2019.08.27.01.02.12; Tue, 27 Aug 2019 01:02:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0dl0qgto; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731443AbfH0IAU (ORCPT + 99 others); Tue, 27 Aug 2019 04:00:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:55028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730351AbfH0IAT (ORCPT ); Tue, 27 Aug 2019 04:00:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 96E47217F5; Tue, 27 Aug 2019 08:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892818; bh=mmRLWluwhVprgaKSs4nQV6TYB0RRn5wKy+LaxHGc4DI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0dl0qgtotKw7gqfMomFp/esPpUL0wx9LzbJhGbiQ8jdgHPvbKplehcFOi8gLi5C67 HXqMUknA2ekZXMmRLJZirg7mY6R5p/WUj5UDlsYo8oKgSRWsTF4UPg+Xa44OfoTWDO QFtRR3hKWkRrKv9IrskVn6PD4B71qv+6k4wX5BaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenwen Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.2 025/162] ASoC: dapm: fix a memory leak bug Date: Tue, 27 Aug 2019 09:49:13 +0200 Message-Id: <20190827072739.183222945@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 45004d66f2a28d78f543fb2ffbc133e31dc2d162 ] In snd_soc_dapm_new_control_unlocked(), a kernel buffer is allocated in dapm_cnew_widget() to hold the new dapm widget. Then, different actions are taken according to the id of the widget, i.e., 'w->id'. If any failure occurs during this process, snd_soc_dapm_new_control_unlocked() should be terminated by going to the 'request_failed' label. However, the allocated kernel buffer is not freed on this code path, leading to a memory leak bug. To fix the above issue, free the buffer before returning from snd_soc_dapm_new_control_unlocked() through the 'request_failed' label. Signed-off-by: Wenwen Wang Link: https://lore.kernel.org/r/1563803864-2809-1-git-send-email-wang6495@umn.edu Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-dapm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 835ce1ff188d9..f40adb604c25b 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3705,6 +3705,8 @@ request_failed: dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", w->name, ret); + kfree_const(w->sname); + kfree(w); return ERR_PTR(ret); } -- 2.20.1