Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp833865pxu; Mon, 23 Nov 2020 05:28:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwj9nyXDsYgB55/vVN5y3fR3GuS11ayKSEsAS38DC9MCPSvpMJ7HgtCLbqmdj5RUEqpTcIb X-Received: by 2002:a05:6402:144b:: with SMTP id d11mr47865993edx.195.1606138098951; Mon, 23 Nov 2020 05:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138098; cv=none; d=google.com; s=arc-20160816; b=yQoqtpsAwpvJiOsLp6agxCQaE2xsSQ2A8gb+awjBw9V4DSGO3E0CSbEdUE+xr9TOZo b17uW8IxX+aUSv7bF66yjWZ0V2ShavJHeF8PMb/KqU8sot0L+eR8IVNDbT7UGVO4ochf Ap8EklE0ruOMoqFndvu56BCfec1uugQMq0KzPrpQAYb5b9YwrjE2T1eejclS3Pe2bcsl YqLTmo0jZibTmxM567Xkl53Ynvta+8+PBnSDjKI4h2LTK9qEZ6Yq7k31dlZGhoSqfXlG iqmDKMja8fa5AsIjXrJ6THOQYLn9pTnAMoPlSYkMDMyToMAlTWctMD6y9PndqY3DiE68 aQag== 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=01HnlM1QyZXVqXPDhw+JAfDXOLxn2acg3vcUmtVg7WA=; b=Tj61K9OJUF6oLKoMQvZPaaCm4/3A5/sXlGF2q/QYTe1ktzvnyuh0zPkNkqRZO+f+ob GdfOA6YlZ0LtrfxAcdxKUjMTzYn+ABxCPMO51q6ZIgNKTQ+TixE+fFh3pRz1yPOY0/aA zVO836r6lh+uz8gSwTIawMe77rH6KyeTUYPDURszhFXS+NkEzhGLF1FOXlV/k6Jyqubr tA22cYqZX5dFFKUBy3yP+1h1itSSPy7nh3ER8FlduTfIcFjaVWGzaIHKx7GIgfPwI74w MnCLTzUkKDMfuJhEn4XS9Dws+aqvtDcfSfe6K9wOZRdl1CcZJO7XZNzR/Icwj0Fgk1Aj xL5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RNVbCgkl; 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 n16si6618122ejb.509.2020.11.23.05.27.56; Mon, 23 Nov 2020 05:28:18 -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=RNVbCgkl; 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 S1731532AbgKWNXU (ORCPT + 99 others); Mon, 23 Nov 2020 08:23:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:47404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730646AbgKWMf2 (ORCPT ); Mon, 23 Nov 2020 07:35:28 -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 EF6302065E; Mon, 23 Nov 2020 12:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134928; bh=aNyI+XuCBtY/W1nfHWgC6jRn7Qpr6fXjvl1WXNpFmW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNVbCgkl35tpApnRa5V0QoeHSjXcp5o+ko5MBkZBEMHg0HbVNpKXX1ezS9DKNRlD3 R+oCOwrn2/SGD/uX38ljGOAkVetk6GCzTtDbeFHa/Bwn4jO+Wn/QTdjrJP44lcEp8U XyUdxQqpu+URXIUBjZViySxvTuWhXgzYLFVAbolc= 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.4 042/158] gfs2: fix possible reference leak in gfs2_check_blk_type Date: Mon, 23 Nov 2020 13:21:10 +0100 Message-Id: <20201123121821.956593197@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@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 3d5aa0c10a4c1..5d9d93ca0db70 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; } -- 2.27.0