Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp310757pxj; Thu, 20 May 2021 09:50:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8LY9V+Xwg+QFcUNfjrALs8VabFL3XaS/U1CRASjThHIWgPyE9ps/WpcEVBXtPEduiTNtH X-Received: by 2002:aa7:d50a:: with SMTP id y10mr5939287edq.161.1621529430088; Thu, 20 May 2021 09:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621529430; cv=none; d=google.com; s=arc-20160816; b=xI4vSIFDpYL58L/0Ip9uKAJ0bJSUPuz2z79Lrm1O08mAjz9hVE+jd4DtlLU3d1+iuR DluoGU+FqKkIcXkv8K2I8pSS1zl1ILOqz7DoWUtJolUANOmbzZ2b76KErIO39QM+Dikn 5IOwfrIK4yVebzVNcJTTdC/MKe/zaHK5oeDhVZAYf9TpCHFH9mk3/rHov1qvKZOW+f65 fo8o/UUHPufKdVycztg83gAx6KsHWENqoYDJRmwmMVUOGr8GbO5Iu32LsIForGw4koB2 6beR15MRoHxkS4JKDqVpVG+KjbSpKRnQqjkQg05xshGgLbOg857wBO0ZNk9RFER3MCm9 roLQ== 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=lnJzrQfgDVJ5tR2N6yA7UCggu/FzBnqS/zsdzRAg/4A=; b=qTuQI6qI3sHhquw495CQL96TY9tXpQF6sEFoN3p8n1DFfojHjT94chTZVCiMLfl1ng tmitBzVWaek4gCfSAPC1XKB1t+EbyMp4SSOhM35+PVtyEOgAnJGRfpdX3Ev6ScoAL25G WYGWoCK7CrFQ0AXxn06NO795E7flJHG8i+quRAqqDzdVFc3S6xlcRhCBtLqEutbTg9d3 kYCX0oUCABm3w+H/n7S/4fYbWHBWlv0SiZ67k0cn3gOCY09vviPhZXiE6wrwj+1q1K80 hNoPog3poMMut83n5gSG4LLuGM/yy31t2WC1/kq1tHs3fw8DyCkQ8xL1i1CgmySyD9EC hVAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PCV9YAvG; 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 z6si2496245edc.27.2021.05.20.09.50.06; Thu, 20 May 2021 09:50:30 -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=PCV9YAvG; 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 S234134AbhETJxO (ORCPT + 99 others); Thu, 20 May 2021 05:53:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:54306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233989AbhETJum (ORCPT ); Thu, 20 May 2021 05:50:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9372161402; Thu, 20 May 2021 09:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503332; bh=JEjMomRIq32gl4H5PYOHlwhLrF4zZdk8IYE7TeuQxAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PCV9YAvG6CynAlsYSWxHU7RmowbH1NiJZzlsXX/Ew1OzgBJ8arqjRV9kplggOAt3r qyH2POkesvTFjAizJlMr30Ud7DrszHZnAqDIUgQSQRqHb4mVgLqI6MowLQ0WDXPRjz bjIYdgwdLn2nDV1uhFCXALxBc6zhHDOvNMM62AAU= 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 4.19 172/425] regmap: set debugfs_name to NULL after it is freed Date: Thu, 20 May 2021 11:19:01 +0200 Message-Id: <20210520092137.096545972@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 c9e5381a887b..de706734b921 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -665,6 +665,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