Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp592716ybt; Fri, 19 Jun 2020 08:55:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuli17RvnIqHoyslGqIGHUref2OhPOK6fvmoRMfdEkhBadpHnPzsHq1mdiELXYiG41Dt/N X-Received: by 2002:aa7:cb53:: with SMTP id w19mr3868356edt.328.1592582107790; Fri, 19 Jun 2020 08:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592582107; cv=none; d=google.com; s=arc-20160816; b=g3Gzuof0xdk8AIcrQ/jO4nPTi6xuWNtqdk7ycN43hoRBDFWIla9g3OJtecKLlRE3B7 tLj6MqC3/LyJk64u5eLyJymGDqGMTryi3T3Urppnh6XJK564hHPcI2w4uipFzwLoFaBr 7wF73fbXPX9DNH2YvBXakBKIscfaxlWduBgw0iwNrHZq4q5Nk7mb/XnUxv4/OhoOrGzJ BwtkQewJn9+4lm4TqY4nl+UeAqa8lySC4lUWYZevBEhNbxmB/xy1IMm6XoZrT+FHJafs ueuYAeE06M0WeI6IMGdOb0kEPcodNtDAL6cW8Dnc3i3zW+l6crbIjDG0bO6Y5/VvHSjz /eaQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0TkCX8wh2omev+qICz+KkpL2SzNX/Pcyz2g1yNxv5S8=; b=zinXu0Zx9ud3/ueJqogtc0GG0g+VJ11fLOUQqO31LN7TlnjOy91Pdh+/YsEpeQ6+ho xT3Jm2+I8aOvKK7sLgwR4+6QFctbdxqTANOaLtVw30EhBpUXu0d9a8DTfg12ACiVl+A+ iAY5Rq9VojE8L/F28ssHGAkM1oyq2W/hkX1Rv3/UOT788QmN9nWFon7G4wTPwWmN7QJY JQhBaf89ndZuH9WBrCqImUSZb1WlFLQl3Hcl+GV7zeuVrvB1rTnvBnJV52MXHCu2Jr7/ G4hb399G8ygfXufGfGFRrs7L8AJeQzgJp1UIMF1i0em/BHb6BBYJcbmPL1qGZp4yJll9 vk8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PcakEWAu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba16si4092788edb.52.2020.06.19.08.54.45; Fri, 19 Jun 2020 08:55:07 -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=PcakEWAu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405353AbgFSPwO (ORCPT + 99 others); Fri, 19 Jun 2020 11:52:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:55002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393178AbgFSPX1 (ORCPT ); Fri, 19 Jun 2020 11:23:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7460D21548; Fri, 19 Jun 2020 15:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580206; bh=5TvpbYkiQw9NZ9edJDaOVOmu8yyAmlourZTRXxSr9R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PcakEWAuD9eCBECSjmFBW4CvgANHBsHRpUpcmPJHLr5aRmxFLsr3ElTVBC/9AjLpw P2M4IrrdKUNhAQg7JYyiM6fd+8YBWdJQgbd0J6F68nsylOZCkOcX+FtmSzC9du6Zyu ddsLZIh3hi6X4/mipbqa0ihMB4JCUbYz7MPNS9CM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Foster , Dave Chinner , Christoph Hellwig , Allison Collins , "Darrick J. Wong" , Sasha Levin Subject: [PATCH 5.7 163/376] xfs: fix duplicate verification from xfs_qm_dqflush() Date: Fri, 19 Jun 2020 16:31:21 +0200 Message-Id: <20200619141718.038795724@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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