Skip to content

Commit bc92381

Browse files
Zhang QilongAndreas Gruenbacher
authored andcommitted
gfs2: fix possible reference leak in gfs2_check_blk_type
In the fail path of gfs2_check_blk_type, forgetting to call gfs2_glock_dq_uninit will result in rgd_gh reference leak. Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent f8394f2 commit bc92381

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

fs/gfs2/rgrp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,13 +2529,13 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
25292529

25302530
rbm.rgd = rgd;
25312531
error = gfs2_rbm_from_block(&rbm, no_addr);
2532-
if (WARN_ON_ONCE(error))
2533-
goto fail;
2534-
2535-
if (gfs2_testbit(&rbm, false) != type)
2536-
error = -ESTALE;
2532+
if (!WARN_ON_ONCE(error)) {
2533+
if (gfs2_testbit(&rbm, false) != type)
2534+
error = -ESTALE;
2535+
}
25372536

25382537
gfs2_glock_dq_uninit(&rgd_gh);
2538+
25392539
fail:
25402540
return error;
25412541
}

0 commit comments

Comments
 (0)