All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: aahringo@redhat.com, gfs2@lists.linux.dev
Subject: [PATCHv2 RESEND v7.4-rc3 5/5] dlm: fix memory leak on active leaving member
Date: Fri, 20 Nov 2026 15:00:40 -0500	[thread overview]
Message-ID: <20261120200040.257152-6-aahringo@redhat.com> (raw)
In-Reply-To: <20261120200040.257152-1-aahringo@redhat.com>

When a node calls dlm_lockspace_release() locally, it does not
subsequently run recovery. Commit de7b4869b4ec ("dlm: add new configfs
entry release_recover for lockspace members") entry began tracking
leaving members to perform optional post processing, such as invoking
the slot callback. Because a locally leaving member does not execute
recovery, it never invokes dlm_config_nodes(), leaving the allocated
tracking entries uncleaned.

This issue was detected by kmemleak.

unreferenced object 0xffff88811d68bcc0 (size 32):
  comm "dlm_controld", pid 406, jiffies 4294749992
  hex dump (first 32 bytes):
    03 00 00 00 00 00 00 00 08 bd 68 1d 81 88 ff ff  ..........h.....
    88 bc 68 1d 81 88 ff ff 00 00 00 00 00 00 00 00  ..h.............
  backtrace (crc be1c20bb):
    kmemleak_alloc+0x85/0xa0
    __kmalloc_cache_noprof+0x2ac/0x380
    drop_node+0x73/0x550
    client_drop_item+0x83/0xe0
    configfs_rmdir+0x735/0x910
    vfs_rmdir+0x24a/0x820
    filename_rmdir+0x3a3/0x4a0
    __x64_sys_rmdir+0x42/0x60
    x64_sys_call+0x1e8d/0x1fb0
    do_syscall_64+0x87/0x490
    entry_SYSCALL_64_after_hwframe+0x76/0x7e

A local node executing dlm_lockspace_release() does not require additional
recovery handling, such as invoking the slot callback. Fix this memory leak
by freeing the resources allocated in drop_node() when the lockspace
configfs entry is released.

Fixes: de7b4869b4ec ("dlm: add new configfs entry release_recover for lockspace members")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/config.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 6ebc0fa9a2fa..5e41f795366c 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -533,9 +533,18 @@ static struct config_group *make_space(struct config_group *g, const char *name)
 static void drop_space(struct config_group *g, struct config_item *i)
 {
 	struct dlm_space *sp = config_item_to_space(i);
+	struct dlm_member_gone *mb_gone, *mb_safe;
 
 	/* assert list_empty(&sp->members) */
 
+	mutex_lock(&sp->members_lock);
+	list_for_each_entry_safe(mb_gone, mb_safe, &sp->members_gone, list) {
+		list_del(&mb_gone->list);
+		sp->members_gone_count--;
+		kfree(mb_gone);
+	}
+	mutex_unlock(&sp->members_lock);
+
 	configfs_remove_default_groups(&sp->group);
 	config_item_put(i);
 }
-- 
2.43.0


      parent reply	other threads:[~2026-11-20 20:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 20:00 [PATCHv2 RESEND v7.4-rc3 0/5] dlm: various fixes Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 1/5] dlm: fix socket hang on send buffer limitation with socket error Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 2/5] dlm: reject wrapped messages with oversized inner lengths Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 3/5] dlm: don't publish a lkb in ls_lkbxa before it has an rsb Alexander Aring
2026-11-20 20:00 ` [PATCHv2 RESEND v7.4-rc3 4/5] dlm: don't set RSB_MASTER_UNCERTAIN on rsb with no master Alexander Aring
2026-11-20 20:00 ` Alexander Aring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120200040.257152-6-aahringo@redhat.com \
    --to=aahringo@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.