Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp878296pxk; Thu, 17 Sep 2020 20:07:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaS3fodt8/jR8roLhs9CZdPETorhP7FtnO66pZjf0s/mvJJulfuh1EllZVkqKJ4PT2GS/j X-Received: by 2002:a05:6402:184d:: with SMTP id v13mr37190784edy.240.1600398422862; Thu, 17 Sep 2020 20:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398422; cv=none; d=google.com; s=arc-20160816; b=mOEQQJLb6vCDrDpxC0+qfXNjDhfyInhSjkHCH0gQDzb9MjNOw6txnqw2SQCc7sVmcW raQQjIbfhCEHeEyfxcts45fbNz0VyyekjR+EK0y8Ye+ghN5RcPKZtWQXoUKW7X3oaYdB HuSx7pnvv+2twqdmo9xRIfIvc8zN+E2bowWH3b8tJ3Kp+QNEeDRBYpHWbLmAoN9Du1hO QHCJLldp80G8M3+zFSLAckJJPFMrVmPp/DHn/q1JesKlY2rFdb21a+28kUPSJsAUgyfm QTJaHNNVCGucBFoIsrmqYfA7bqnmtLPeJFBATzAzAN438IFK5Up3jOtjeqIgsZd7W7tm /eEA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n8GrSQLyPFZgbgK/LmxxTzFELuTSwj9V0aOW0XJoANY=; b=hX7VzuUCBX/dt8FDPWhGZd4fZqcqrXWI4hg98lbd7hVvThHpylNcjsNUv5m6yP8qz3 YY5giUJ+EtnjLsP3qUphqO3yRp2raNjj//oSm/s0djqhsVumjeyaAZ6TTQo/naYoMfO+ UzlghblsaEv+sw3wofQfJZw2QxzmoobG5Is+WIQP8C3tRw68D72aff6lgT+Bf8tbcHc9 UvefQFevQ6JacZVEpbOG8UWmjiw/Ik0FwUSa+w8p+JfFSpb6L7ir1wPuGjwLXNkBs6Cx 3enRgCJ3HNu88xigpOVQppmVh8hWIFV9pRYM0dYZnjQGkQUC/IKo3Z/YOBUIPRzehrUh 9EFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rSYmj3Rd; 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 s3si1269109ejv.383.2020.09.17.20.06.40; Thu, 17 Sep 2020 20:07:02 -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=rSYmj3Rd; 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 S1730477AbgIRDEX (ORCPT + 99 others); Thu, 17 Sep 2020 23:04:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:52458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbgIRCEq (ORCPT ); Thu, 17 Sep 2020 22:04:46 -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 2EDFD23731; Fri, 18 Sep 2020 02:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394682; bh=a3KtIY3zS5tFGMw/4re3J0MkdSRhsoocIYujeU5Ijgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rSYmj3Rd09vzCtk6Y1ljYdeR93aknvKd7cuijxdq0G5zi7cmkn82yGEJG5VQraqmu pV9uStMslnO188s7iaulFw/TvtjYndjETYv9FKAMbgdN8BN0wsJnxEfsLa4Xpbi25h wyArt+A5YrexKNgxrkCFVvYx28wZW+ekz2LWPhGM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Darrick J. Wong" , Dave Chinner , Sasha Levin , xfs@oss.sgi.com Subject: [PATCH AUTOSEL 5.4 172/330] xfs: mark dir corrupt when lookup-by-hash fails Date: Thu, 17 Sep 2020 21:58:32 -0400 Message-Id: <20200918020110.2063155-172-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Darrick J. Wong" [ Upstream commit 2e107cf869eecc770e3f630060bb4e5f547d0fd8 ] In xchk_dir_actor, we attempt to validate the directory hash structures by performing a directory entry lookup by (hashed) name. If the lookup returns ENOENT, that means that the hash information is corrupt. The _process_error functions don't catch this, so we have to add that explicitly. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Sasha Levin --- fs/xfs/scrub/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c index 1e2e11721eb99..20eca2d8e7c77 100644 --- a/fs/xfs/scrub/dir.c +++ b/fs/xfs/scrub/dir.c @@ -152,6 +152,9 @@ xchk_dir_actor( xname.type = XFS_DIR3_FT_UNKNOWN; error = xfs_dir_lookup(sdc->sc->tp, ip, &xname, &lookup_ino, NULL); + /* ENOENT means the hash lookup failed and the dir is corrupt */ + if (error == -ENOENT) + error = -EFSCORRUPTED; if (!xchk_fblock_process_error(sdc->sc, XFS_DATA_FORK, offset, &error)) goto out; -- 2.25.1