Skip to contentSkip to conversation

gfs2: Fix memory leak in gfs2_make_fs_rw()

PATCH In review Qing Wong 2 participants 2 messages Feb 5 – Feb 8 GFS2 file system

lore
Share & tools
lore

Qing Wong

author
#0 lore raw

PATCH 1/1 gfs2: Fix memory leak in gfs2_make_fs_rw()

From: Qing Wang <[email protected]>

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

Reported-by [email protected]
Fixes 601ef0d52e96 ("gfs2: Force withdraw to replay journals and wait for it to finish")
---
 fs/gfs2/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/gfs2/super.c +4 -2
index f6cd907b3ec6..efa0e2452bc7 100644
@@ -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;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 4 lines · Qing Wong

From: Qing Wang <[email protected]>

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