Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp35089lqe; Tue, 9 Apr 2024 13:35:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULWSYvV53/CZYPEWlQ5MM7oDQZ/zXtv3Q7by8KjnWxjtTgtjpJeOSeSZLiaqGIoLvf5ba+ALEe/1vrJrnEnXPVQci9REn/o255yxBnBw== X-Google-Smtp-Source: AGHT+IEKvf0suuYpWqewX5y4Vhd47m5nJi7x5O2aINKJ6227YgOTl0GzWE7hoVEmWZS2JR9vBg5L X-Received: by 2002:a05:6a20:3d89:b0:1a7:8127:c919 with SMTP id s9-20020a056a203d8900b001a78127c919mr1132551pzi.43.1712694950953; Tue, 09 Apr 2024 13:35:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712694950; cv=pass; d=google.com; s=arc-20160816; b=Zj70WsKfCxavD+NdMiYFwVtZGcJLr3WtgdpyubyAkhDltgNSHwtdhfym44S6kGs+68 tfyMUfgbzmOnhOsdRh9e6TH2EQ7HmynyYlN2QkSz7LS2PBOzwpjPKCrKAoYpyP1+wKqg mTbEYivFvL4ZNps4Z+OoKDupkjfbPhVxIfMnw2uCZpxaX7jJhBiBs1Q3C9eEuYqP8xLp UUVngUiRfG/cT4+8sUK3rFkDddWHWDTenWB3wVqwtNQVRxoV+Qa2MyzyisKxlt56Yi20 WSYTUQqwv7f7ojFIXZo+cRn0KMsLo+E0MEGHVIGfE8/w2Qn9HxguD2j5aMc0p8/9mjvR fwbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=chP/1/6goYaphGUjfEv2QXzQENrepAGweOTmsWv0VR8=; fh=rqHW7NazYv3wAmgqDKAbZUXWTmf0VaM5epB9R4zfTUE=; b=ymky7+ONCwj3j1G+e0Jmy0pB5OR4dzTnSDHKsuDe0GHnH5etCWgNjjiqWekdqfFKOE PBJ0fRWwrqhkRVOB4ivGMSsAr8eNa+IGSr3oYiMwYj+CjboppWq/jHqCDtrLo4ezdsRb c0AJehITZ+i6mEKtRLus0vYPY/O+fz6av5VqXpK3bN7a7UuTybA5Pu2InWkfQL0qGCFw VmdcFaDe0gAEy6G5aGBZXHX20gU5lPdjfHQRBEI7FPE1GFCC3C98VUkJPMzNVKUXXTpS qSntemowEPe4R4fBj6yfTtl65Lt4AHqhGImASW0Ti7WXx4ncecns4OJR/lmgzPkWYwvR jidA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="FOjfp/7g"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137601-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z18-20020aa79912000000b006e6b2b2b0f8si9098100pff.354.2024.04.09.13.35.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 13:35:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137601-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="FOjfp/7g"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137601-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5AA24B219F5 for ; Tue, 9 Apr 2024 20:34:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F9FA158840; Tue, 9 Apr 2024 20:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FOjfp/7g" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA0111586E5 for ; Tue, 9 Apr 2024 20:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712694857; cv=none; b=qBgiz6BdccpXqJVK6mv2amb/hRO5nj5rts8HW5XHdnMKJvSQfEgvb8hgbScUtj2LRCR09TXDWAHuFyouOTxBxRj3ndVaGH44qQtotiHaUgc02QPEy1WdwRtszgSLsyiOa8c8ItPgOwvMg/3sH/OpG+zqr0ZxU6KFfw1dCab342M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712694857; c=relaxed/simple; bh=+4w6Yn40335a0GsU306fLSUnzxXEUP2Ol6OJgXDYeI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QWESsg5Sd7hxQyuviJrrBpDShVBqLCugikEXusCoUAy/ZafPvcXVdDvOAMULNUsPndNtp49VXWvhQ7woiQirgdTj++qN/fG7M4omriN7pvocQeM6L8svJies3muE9ICXNEyUSXCrImq08Yk37VXMMoy2XCKrcUcfWh57sp4klC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FOjfp/7g; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B26AC433C7; Tue, 9 Apr 2024 20:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712694857; bh=+4w6Yn40335a0GsU306fLSUnzxXEUP2Ol6OJgXDYeI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOjfp/7g2+iX4WP7BmUILh7tqFC85L1DLkTG24ckMIrxOZGocygA/5bs19BDuOc3M BDtYlBc+gY0lkLP8sezyoUt/3Qx8AV0wO1ptAMIQJNjHKglQcweQmZXRaW6aMeyWdZ jz3fF0yGMNUcvDFc4GqmvwlU3eXu+JGxnYClbmc5OJc9MamBMmApbAvftFWvUCaDCi ZLLFjUw1H5Fdf9Wv0Pjd3Sbx5dlmGQlRqc3cyQEH5jJwZi2NU1cnXJsJJX8bEOlhEB bKt1XiCNEK2kCv6R0y1q5n9pAS7EogAtl1Ed1ndGkIbZl30272kQWaGuYQGUoDfNfy zjtcH1ozj0BCw== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 3/3] f2fs: fix false alarm on invalid block address Date: Tue, 9 Apr 2024 20:34:11 +0000 Message-ID: <20240409203411.1885121-3-jaegeuk@kernel.org> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog In-Reply-To: <20240409203411.1885121-1-jaegeuk@kernel.org> References: <20240409203411.1885121-1-jaegeuk@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit f2fs_ra_meta_pages can try to read ahead on invalid block address which is not the corruption case. Fixes: 31f85ccc84b8 ("f2fs: unify the error handling of f2fs_is_valid_blkaddr") Signed-off-by: Jaegeuk Kim --- fs/f2fs/checkpoint.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index eac698b8dd38..b01320502624 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -179,22 +179,22 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi, break; case META_SIT: if (unlikely(blkaddr >= SIT_BLK_CNT(sbi))) - goto err; + goto check_only; break; case META_SSA: if (unlikely(blkaddr >= MAIN_BLKADDR(sbi) || blkaddr < SM_I(sbi)->ssa_blkaddr)) - goto err; + goto check_only; break; case META_CP: if (unlikely(blkaddr >= SIT_I(sbi)->sit_base_addr || blkaddr < __start_cp_addr(sbi))) - goto err; + goto check_only; break; case META_POR: if (unlikely(blkaddr >= MAX_BLKADDR(sbi) || blkaddr < MAIN_BLKADDR(sbi))) - goto err; + goto check_only; break; case DATA_GENERIC: case DATA_GENERIC_ENHANCE: @@ -228,6 +228,7 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi, return true; err: f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR); +check_only: return false; } -- 2.44.0.478.gd926399ef9-goog