mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gfs2: Fix potential recovery bitmap leak on mount failure
@ 2026-11-10 14:32 Guangshuo Li
  0 siblings, 0 replies; only message in thread
From: Guangshuo Li @ 2026-11-10 14:32 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: gfs2, linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-10 14:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 14:32 [PATCH] gfs2: Fix potential recovery bitmap leak on mount failure Guangshuo Li

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®