gfs2 filesystem and dlm development
 help / color / mirror / Atom feed
* [PATCH] gfs2: Fix memory leak in gfs2_make_fs_rw()
@ 2026-02-05 13:53 Qing Wong
  2026-02-08 12:55 ` Andreas Gruenbacher
  0 siblings, 1 reply; 2+ messages in thread
From: Qing Wong @ 2026-02-05 13:53 UTC (permalink / raw)
  To: Andreas Gruenbacher, Bob Peterson
  Cc: gfs2, linux-kernel, Qing Wang, syzbot+e57495fb65020ac7bca4

From: Qing Wang <wangqing7171@gmail.com>

If gfs2_quota_init() success and filesystem is withdrawn, need to cleanup
by gfs2_quota_cleanup() to avoid memory leak.

Reported-by: syzbot+e57495fb65020ac7bca4@syzkaller.appspotmail.com
Closes: https://syzbot.org/bug?extid=e57495fb65020ac7bca4
Tested-by: syzbot+e57495fb65020ac7bca4@syzkaller.appspotmail.com
Fixes: 601ef0d52e96 ("gfs2: Force withdraw to replay journals and wait for it to finish")
Signed-off-by: Qing Wang <wangqing7171@gmail.com>
---
 fs/gfs2/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f6cd907b3ec6..efa0e2452bc7 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -147,8 +147,10 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
 	}
 
 	error = gfs2_quota_init(sdp);
-	if (!error && gfs2_withdrawn(sdp))
-		error = -EIO;
+	if (!error && gfs2_withdrawn(sdp)) {
+		gfs2_quota_cleanup(sdp);
+		return -EIO;
+	}
 	if (!error)
 		set_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
 	return error;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gfs2: Fix memory leak in gfs2_make_fs_rw()
  2026-02-05 13:53 [PATCH] gfs2: Fix memory leak in gfs2_make_fs_rw() Qing Wong
@ 2026-02-08 12:55 ` Andreas Gruenbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2026-02-08 12:55 UTC (permalink / raw)
  To: Qing Wong; +Cc: gfs2, linux-kernel, syzbot+e57495fb65020ac7bca4

On Thu, Feb 5, 2026 at 2:53 PM Qing Wong <wangqing7171@gmail.com> wrote:
> From: Qing Wang <wangqing7171@gmail.com>
>
> If gfs2_quota_init() success and filesystem is withdrawn, need to cleanup
> by gfs2_quota_cleanup() to avoid memory leak.

This is already taken care of by commit da6f5bbc2e79 ("gfs2: fix
memory leaks in gfs2_fill_super error path") now.

Thanks,
Andreas


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-08 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05 13:53 [PATCH] gfs2: Fix memory leak in gfs2_make_fs_rw() Qing Wong
2026-02-08 12:55 ` Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox