mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] gfs2: Fix potential recovery bitmap leak on mount failure
Date: Tue, 10 Nov 2026 22:32:21 +0800	[thread overview]
Message-ID: <20261110-9f141e6bc8-gfs2@mail.sdu.edu.cn> (raw)

set_recover_size() can allocate the LVB bitmap before failing to allocate
the recovery arrays. Use the recovery cleanup path on this failure so
the bitmap is released before the superblock is freed.

This issue was found by our static analysis tool under development.

Fixes: 57c7310b8eb9 ("GFS2: use kmalloc for lvb bitmap")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 fs/gfs2/lock_dlm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 47eec0c13025..f3d2c6ad614f 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -1315,7 +1315,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
 
 	error = set_recover_size(sdp, NULL, 0);
 	if (error)
-		goto fail;
+		goto fail_free;
 
 	/*
 	 * prepare dlm_new_lockspace args
@@ -1384,7 +1384,6 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
 	dlm_release_lockspace(ls->ls_dlm, DLM_RELEASE_NORMAL);
 fail_free:
 	free_recover_size(ls);
-fail:
 	return error;
 }
 

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

                 reply	other threads:[~2026-11-10 14:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261110-9f141e6bc8-gfs2@mail.sdu.edu.cn \
    --to=liguangshuo@mail.sdu.edu.cn \
    --cc=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®