Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1310245pxu; Mon, 23 Nov 2020 18:01:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvvYDjJ3b0txW/53+kaFJx0GA5YGg0bAU7RM+UdKPz89X6Gnm5rBJ7T41EI/vYdefqLmVO X-Received: by 2002:a17:906:50e:: with SMTP id j14mr2111124eja.403.1606183262975; Mon, 23 Nov 2020 18:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606183262; cv=none; d=google.com; s=arc-20160816; b=vFrJeArPJoRBchq+Z7eDVm+ZFLQt933V2GMaKyiu3HaHXMQENursmE5whVo1wLgUdS AGX/ScS/q0V2Zg+cNiL3DXSI2JLAfe0YwsYfWARAHsQ5h6EyUjx8tZnMuu40a14sCr3i 0BMtN3Zdf4Nd1yGiKDQt5ihqh25nSgAb9ZAlfKfxwdtotIvwLwpeOoTnNolVEZZEyIaQ LKQKh3M/ZKX9GoxVOwZ/tj4omkI76MyhUYY2A/KPMVki8v/DOWtvJEcVUwsSCyk1zgxK 0wZYl9T61AzU+tPYZrlEZjLMxQ08nyn9sCYV7LYSS8CX6ggj5jEnn8LvERCU0Vx6TeTg GizA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dcpnepYbZcqESxdw0yixIvyXxKbGucgRd40l9/UPDlo=; b=W7Zl3F7A60JhS/SGUNB9IDCWLtklrQ++Fov0vGwxcbbgMo+/RdooXLjFSRfP3ffeU5 YqxrAW3U8Tk+vKf1/2gD/Yta2AAxE9bUHfs4hR9aRgsCQ9H+tTX77KEAt0T1WRCN0zP5 cCdKaYie5x85A8vKxVX+vr0bNaP6wf28JLmAbJwD+QWUwzAljVnvOfgYcilrOpSAT2W4 Kb5t49euhO5mpKquvE+yiKP9uo6UZ4TV6sNZKgr2DJZjos6KYn5G6ZlbrKbS2YyJ/dY3 Pz5wZRvLPcopFzrlT9xGYTvHrZhaqp/b5xamPh0RXDVdYFhK/3hpVYwutLQOWPqO2AJr 8cSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ifA25yPS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qu6si7542586ejb.528.2020.11.23.18.00.39; Mon, 23 Nov 2020 18:01:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ifA25yPS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730963AbgKWMpT (ORCPT + 99 others); Mon, 23 Nov 2020 07:45:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:57096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733160AbgKWMn6 (ORCPT ); Mon, 23 Nov 2020 07:43:58 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 22A4E20857; Mon, 23 Nov 2020 12:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135438; bh=DKkEutsNNEgL7gdgdJMWMhSEVqGgTmR+8TxCP+Llo4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifA25yPS4a0PuTYKMfPj0S1oxaO6kNMYsF6kFKSNtli4MEyVE90aSBDXPvmmZXPJ+ zutNCeBgbXXlr2ZhpVIY2UJIH0BCu2RD2nxzUj0KVd/MaI/4wZ+Clg0SgkaL/rPUrr +JIyTMwpM8zI1aN1jn7tIQcFsEItYluvQXaKiaKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Andreas Gruenbacher , Sasha Levin Subject: [PATCH 5.9 068/252] gfs2: fix possible reference leak in gfs2_check_blk_type Date: Mon, 23 Nov 2020 13:20:18 +0100 Message-Id: <20201123121838.869579559@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121835.580259631@linuxfoundation.org> References: <20201123121835.580259631@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ 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 Signed-off-by: Andreas Gruenbacher Signed-off-by: Sasha Levin --- 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 ac306895bbbcc..d035309cedd0d 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -2533,13 +2533,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