Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4607383pxj; Wed, 12 May 2021 09:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY2V02gI7E9ZG4KwV+2/O97uGDiw66z2WlnrweV/1ahaLNwpVAP78l/7lEWrxYtVHS/0pg X-Received: by 2002:adf:f991:: with SMTP id f17mr44718172wrr.160.1620835714141; Wed, 12 May 2021 09:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835714; cv=none; d=google.com; s=arc-20160816; b=O+LFLQg9Hd6aUU4ydGTTr52zb94AS2tIgNJ9wL7dj4H8ilMODCZj+D8aJ6bgsLDFs0 DpcbL1T0mhk1VK/QuN03mCzCfPkj5cJdAPUAE9HElQhlAaRr2ae2KjIdkxhTw+rhY4D7 7w5PMrPutRgwNjLVIMPS7islOVsQhtyPfKfkiuux57T7U9hh/DhTzeVm+iZ7yibRsmcE bpS98Uu+FURZXgCFRNM+k3xXAYk9Qg7uUDqp0B4Zm0prCDNPiIBBp9OMLpkseSd+lJ/J R914bB2iIohWczcEtli8aOYMSmFIVo2FmUTb+3v53n/75Fjzqss0qrOLvU0LHpcNjQsC WS0g== 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=U7qZkBZXTvg8sTACmS+bALgboLlgWPD47+aNaCnmO2U=; b=vBvOuf5L2gW3xaqyMKtgiFmXt1Yezekos9JUN2xxBS2dx9jrpgmVD68cGFbwwFaYsC AUoEtmzgT3yg/9sDZmWccKsqWJ7pgqwlyKjOL3ryJQITqSdQtD3MG/pTKzp3S++fLKqu jDY3eVKza58W8FPAqKVCifQkVZPvZpj0RkLcNSo6vx+01eOYXjDiaUdQIvoP+Y+3n1ot cpsKkpYPymunrLCxozYRm9i7J122DoSG3QH+44ObpP1NcHxHUGsMZ0oLyi+k5aFjhUJ4 uO4k3qqYy8kqo2yIxuN7+2eKxaJrrTo4lM9TS780PsOs2fvn2TyrjZlB6RZ7E0FXkgzD KbPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V9uKNfGl; 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 u9si311795ejh.586.2021.05.12.09.08.09; Wed, 12 May 2021 09:08:34 -0700 (PDT) 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=V9uKNfGl; 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 S238654AbhELQFs (ORCPT + 99 others); Wed, 12 May 2021 12:05:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:38508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234086AbhELPYV (ORCPT ); Wed, 12 May 2021 11:24:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8625A619BF; Wed, 12 May 2021 15:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832195; bh=dJnl1HIIHYQeuYrh4heyzbBZxjcFq2NDzIonBGPXj6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V9uKNfGlvcJ24nJ2Kc+JlnLxV3+a+NFqMe/4Aj8fmp4h2HSXerQ4I4DllZQTtuO9n Q2W0RrBtrBEVSYcTqPk2REdXwUPrMwtQL5JqGXsh2UA/3A9uzyF/9iR/saGrty+S2H scAZxgDepOfu1vscyeNSOYth1CjaJaf3FygUV/Fg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , Mark Brown , Sasha Levin Subject: [PATCH 5.10 146/530] regmap: set debugfs_name to NULL after it is freed Date: Wed, 12 May 2021 16:44:16 +0200 Message-Id: <20210512144824.633592284@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Meng Li [ Upstream commit e41a962f82e7afb5b1ee644f48ad0b3aee656268 ] There is a upstream commit cffa4b2122f5("regmap:debugfs: Fix a memory leak when calling regmap_attach_dev") that adds a if condition when create name for debugfs_name. With below function invoking logical, debugfs_name is freed in regmap_debugfs_exit(), but it is not created again because of the if condition introduced by above commit. regmap_reinit_cache() regmap_debugfs_exit() ... regmap_debugfs_init() So, set debugfs_name to NULL after it is freed. Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev") Signed-off-by: Meng Li Link: https://lore.kernel.org/r/20210226021737.7690-1-Meng.Li@windriver.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/base/regmap/regmap-debugfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index ff2ee87987c7..211a335a608d 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -660,6 +660,7 @@ void regmap_debugfs_exit(struct regmap *map) regmap_debugfs_free_dump_cache(map); mutex_unlock(&map->cache_lock); kfree(map->debugfs_name); + map->debugfs_name = NULL; } else { struct regmap_debugfs_node *node, *tmp; -- 2.30.2