From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Zhang Qilong <zhangqilong3@huawei.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
Sasha Levin <sashal@kernel.org>,
cluster-devel@redhat.com
Subject: [PATCH AUTOSEL 5.4 10/11] gfs2: fix possible reference leak in gfs2_check_blk_type
Date: Tue, 17 Nov 2020 07:57:24 -0500 [thread overview]
Message-ID: <20201117125725.599833-10-sashal@kernel.org> (raw)
In-Reply-To: <20201117125725.599833-1-sashal@kernel.org>
From: Zhang Qilong <zhangqilong3@huawei.com>
[ 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>
---
fs/gfs2/rgrp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 2466bb44a23c5..2dfcea5a71153 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2571,13 +2571,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;
}
--
2.27.0
next prev parent reply other threads:[~2020-11-17 12:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 12:57 [PATCH AUTOSEL 5.4 01/11] pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 02/11] scsi: ufs: Fix unbalanced scsi_block_reqs_cnt caused by ufshcd_hold() Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 03/11] selftests: kvm: Fix the segment descriptor layout to match the actual layout Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 04/11] ACPI: button: Add DMI quirk for Medion Akoya E2228T Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 05/11] arm64: errata: Fix handling of 1418040 with late CPU onlining Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 06/11] arm64: psci: Avoid printing in cpu_psci_cpu_die() Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 07/11] arm64: smp: Tell RCU about CPUs that fail to come online Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 08/11] lockdep: Avoid to modify chain keys in validate_chain() Sasha Levin
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 09/11] vfs: remove lockdep bogosity in __sb_start_write Sasha Levin
2020-11-17 12:57 ` Sasha Levin [this message]
2020-11-17 12:57 ` [PATCH AUTOSEL 5.4 11/11] hwmon: (pwm-fan) Fix RPM calculation Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201117125725.599833-10-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=agruenba@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=zhangqilong3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®