summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorZhang Qilong <zhangqilong3@huawei.com>2020-11-08 17:27:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-24 13:29:01 +0100
commite240b43268870b981da9eabb361e04d121e4586b (patch)
tree202159515f8c238ccef57507b6546a1e3508f612 /fs
parent195f9e1a5457e7d0a24fc59ec698c1f6b9770220 (diff)
gfs2: fix possible reference leak in gfs2_check_blk_type
[ Upstream commit bc923818b190c8b63c91a47702969c8053574f5b ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/rgrp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 3d5aa0c10a4c..5d9d93ca0db7 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2574,13 +2574,13 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
rbm.rgd = rgd;
error = gfs2_rbm_from_block(&rbm, no_addr);
- if (WARN_ON_ONCE(error))
- goto fail;
-
- if (gfs2_testbit(&rbm, false) != type)
- error = -ESTALE;
+ if (!WARN_ON_ONCE(error)) {
+ if (gfs2_testbit(&rbm, false) != type)
+ error = -ESTALE;
+ }
gfs2_glock_dq_uninit(&rgd_gh);
+
fail:
return error;
}