Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp583125pxx; Wed, 28 Oct 2020 11:40:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIInUmaI8yMk4NDyfyif1bwwFZHFkdZ83EDjnsp/Bc/KSdMomCUidDlVsuC+FAMEE6pLcW X-Received: by 2002:aa7:db07:: with SMTP id t7mr245329eds.161.1603910445004; Wed, 28 Oct 2020 11:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603910444; cv=none; d=google.com; s=arc-20160816; b=yU4r9qTpmmcNcbEI4oKdsLbaq+VRlnJUnRvL0qC35RIVp9Y/4AJzNxOHp/j3sspmrQ LJZ6CZtA0APl+ZlrjiZzW3YKT+EU/18dok5TpMipltEGgrYTrgNTviGtmq3L87rr0vY3 Kl817WkvMkf7rCauI34vvWHo/EgEtKZVTR+vZ9Q38yCV7lm5dXuEAHRq9P4sn523IM4k F4cqkZvPNmiglMgx9TtRVfTIRNDzXAsJv5G/wFCjk6jAbYlsPF4HpcT+mEmJ4Wg5bW0s Vm+P7t44HqZ8cSgCDae6wUOnXHGNUJ1tg7tb/R9sqcfhXqvQP5C2ZE8x3EsPR4ZzvNWM xGOQ== 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=2WfgqhGHPnqqQIOrGgdcOaaf59VXt9FB4+LXvjwO5mc=; b=nrzUX0uqT9EcOnUDKWcC5SAbKJnZHKi7rMqYKpkH3jqCo4VZQbheV+1Hs5zoIkPSvR yM6suRlujr+LMnLaDx5eNpXwoqzCNRX1TACAcLPmrOZGfi+ca5AVQ3s8HMs/o31PTsF6 9fABoErBgUEBN6LJx0o6Kk+0dtdq/tPp0DyoyT7WtC4sRFe33KrUlmTt2OfHrE6qqWeW 8owdBDNP+fqTJF0T61vMLDAFzZS5DmGKepZU2jawBLcxjXIRDS4fLdc+pBDyl+HxsvUc 4rzK4UvjZCCof2VyxF2l21iZO+ucmLfcaClK88ZI7rmlJcxy37VZoas3PbxyRh2srWHl XGBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tfUvh1Fe; 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=fail (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 m26si11386edq.372.2020.10.28.11.40.22; Wed, 28 Oct 2020 11:40:44 -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=@kernel.org header.s=default header.b=tfUvh1Fe; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1825631AbgJ0SMQ (ORCPT + 99 others); Tue, 27 Oct 2020 14:12:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:36434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756686AbgJ0OOr (ORCPT ); Tue, 27 Oct 2020 10:14:47 -0400 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 1E490206F7; Tue, 27 Oct 2020 14:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808086; bh=8F3uUtHSi5y+880/nn5AXD4aT5Eiz5gbBtxIaXiatbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tfUvh1FecIkhnTZNnJJ0jljVRY+F1c5foN3Bqp0Ralf7ir6UXiM5l82CYf2PVtVdR Fv24IsBwLy0CuNuwabBmYYPGyeJRIZJxhjyBMSjzLRj1PWN4A63iul3SS5j/xNhhpN k0I5sI8DhHgON1NYGCfLof4z68HE15BoUgiJuWnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 4.14 152/191] fs: dlm: fix configfs memory leak Date: Tue, 27 Oct 2020 14:50:07 +0100 Message-Id: <20201027134917.014263510@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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: Alexander Aring [ Upstream commit 3d2825c8c6105b0f36f3ff72760799fa2e71420e ] This patch fixes the following memory detected by kmemleak and umount gfs2 filesystem which removed the last lockspace: unreferenced object 0xffff9264f482f600 (size 192): comm "dlm_controld", pid 325, jiffies 4294690276 (age 48.136s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 6e 6f 64 65 73 00 00 00 ........nodes... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000060481d7>] make_space+0x41/0x130 [<000000008d905d46>] configfs_mkdir+0x1a2/0x5f0 [<00000000729502cf>] vfs_mkdir+0x155/0x210 [<000000000369bcf1>] do_mkdirat+0x6d/0x110 [<00000000cc478a33>] do_syscall_64+0x33/0x40 [<00000000ce9ccf01>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 The patch just remembers the "nodes" entry pointer in space as I think it's created as subdirectory when parent "spaces" is created. In function drop_space() we will lost the pointer reference to nds because configfs_remove_default_groups(). However as this subdirectory is always available when "spaces" exists it will just be freed when "spaces" will be freed. Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin --- fs/dlm/config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 7211e826d90df..472f4f835d3e1 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c @@ -218,6 +218,7 @@ struct dlm_space { struct list_head members; struct mutex members_lock; int members_count; + struct dlm_nodes *nds; }; struct dlm_comms { @@ -426,6 +427,7 @@ static struct config_group *make_space(struct config_group *g, const char *name) INIT_LIST_HEAD(&sp->members); mutex_init(&sp->members_lock); sp->members_count = 0; + sp->nds = nds; return &sp->group; fail: @@ -447,6 +449,7 @@ static void drop_space(struct config_group *g, struct config_item *i) static void release_space(struct config_item *i) { struct dlm_space *sp = config_item_to_space(i); + kfree(sp->nds); kfree(sp); } -- 2.25.1