Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp112017ybg; Mon, 8 Jun 2020 17:56:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzobanvpLag6560u40RYHIMZXQryVKcUwBmpO+nuejFjTxVOIF2szgzVtaixM9jT5+B9iaG X-Received: by 2002:a50:b2e1:: with SMTP id p88mr24719689edd.198.1591664218603; Mon, 08 Jun 2020 17:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664218; cv=none; d=google.com; s=arc-20160816; b=RJ8znvgvoApOY0zqWGaGlOM9EfMG8+QqC2IS9GdVJ6+NsSJOtriH94evX91W9mn3Gb hHIXjrPrJxl8o9S28GQHaADsovDVEhD89HfLBJIaBtwYAoL3wvpqlaBnP320IMY/b655 /wfA4ZC6At0aNDaKnuudwBNYxYZzLQjcxkrqfMXK1QbRZQDRfZZBV5z/LnlBxWkFviPs CngD7LkTBHOKUdVC5BNFp8dGlhaMsHjxUePYmEmZIYUFtiPrcs2c56+d4ZdSyI81ySWM dW/0WZxY1QPYqPU22pMxc2dFRrKFhNTfCMGfa/0471KcDkdY/1QJhKxyA1YXrzl1oHan jI3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0TkCX8wh2omev+qICz+KkpL2SzNX/Pcyz2g1yNxv5S8=; b=NN/EIevkEHLSXXJvlRc4R2WTLJrG9bz9J2Ns3KjkORj3dexTIzgh1cuUy3Mc06SG3x I3RAeI04tIF4YzD/wc0v5pues7uXMrAUtvoZLTHy+5fCmaA/fzIUTAbZ1QIqjZdPBhIe ALexEa64xOi7AjsCe4mDtoHZW3gRgrz0WLV+9bjo5gAcOjJ/sOQW2uQVoao2unrVOZXu XPB/avXH6/5Eb91I/2jIeyFaNu30TfKCz+EdwHlOM9JFIvOuRvXKxs1arvc9pcexJvfb O4thZcXonMG7hlDLWfXCTqgD5+7nqvq++AfRSVaJK+UVEKb6bWDmDs1sN+3Hnx9t3zZS ettg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O5HaA7Q8; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ob24si9533523ejb.701.2020.06.08.17.56.35; Mon, 08 Jun 2020 17:56:58 -0700 (PDT) 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=@kernel.org header.s=default header.b=O5HaA7Q8; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730774AbgFIAwu (ORCPT + 99 others); Mon, 8 Jun 2020 20:52:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:55900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728535AbgFHXJ4 (ORCPT ); Mon, 8 Jun 2020 19:09:56 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6B00208E4; Mon, 8 Jun 2020 23:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657795; bh=5TvpbYkiQw9NZ9edJDaOVOmu8yyAmlourZTRXxSr9R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O5HaA7Q8rb6tYJIRdTgHe2wQGuCgdU2+2fgPo7mYEbRB70sw35DW52wwdiE3b/Wva 4NNPnCiyi9EgK5h5+yeAX5DRsyQe49dVJMf0yH/JsHEgNNFz3aG7reEqjmXMq/1Tan SVyLQUWOFZswBYcgXwRP5L0hsjrKZ4wK1kxYz5j8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brian Foster , Dave Chinner , Christoph Hellwig , Allison Collins , "Darrick J . Wong" , Sasha Levin , linux-xfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 174/274] xfs: fix duplicate verification from xfs_qm_dqflush() Date: Mon, 8 Jun 2020 19:04:27 -0400 Message-Id: <20200608230607.3361041-174-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Foster [ Upstream commit 629dcb38dc351947ed6a26a997d4b587f3bd5c7e ] The pre-flush dquot verification in xfs_qm_dqflush() duplicates the read verifier by checking the dquot in the on-disk buffer. Instead, verify the in-core variant before it is flushed to the buffer. Fixes: 7224fa482a6d ("xfs: add full xfs_dqblk verifier") Signed-off-by: Brian Foster Reviewed-by: Dave Chinner Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_dquot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index af2c8e5ceea0..265feb62290d 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -1116,13 +1116,12 @@ xfs_qm_dqflush( dqb = bp->b_addr + dqp->q_bufoffset; ddqp = &dqb->dd_diskdq; - /* - * A simple sanity check in case we got a corrupted dquot. - */ - fa = xfs_dqblk_verify(mp, dqb, be32_to_cpu(ddqp->d_id), 0); + /* sanity check the in-core structure before we flush */ + fa = xfs_dquot_verify(mp, &dqp->q_core, be32_to_cpu(dqp->q_core.d_id), + 0); if (fa) { xfs_alert(mp, "corrupt dquot ID 0x%x in memory at %pS", - be32_to_cpu(ddqp->d_id), fa); + be32_to_cpu(dqp->q_core.d_id), fa); xfs_buf_relse(bp); xfs_dqfunlock(dqp); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); -- 2.25.1