[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210919190638.GA12836@amd>
Date: Sun, 19 Sep 2021 21:06:38 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
stable@...nel.org, Chao Yu <chao@...nel.org>,
Jaegeuk Kim <jaegeuk@...nel.org>
Subject: Re: [PATCH 5.10 045/306] f2fs: fix to do sanity check for sb/cp
fields correctly
Hi!
This code looks quite confused: part of function returns 1 on
corruption, part returns -errno. The problem is not stable-specific.
Best regards,
Pavel
> @@ -3058,6 +3061,17 @@ int f2fs_sanity_check_ckpt(struct f2fs_s
> return 1;
> }
>
> + nat_blocks = nat_segs << log_blocks_per_seg;
> + nat_bits_bytes = nat_blocks / BITS_PER_BYTE;
> + nat_bits_blocks = F2FS_BLK_ALIGN((nat_bits_bytes << 1) + 8);
> + if (__is_set_ckpt_flags(ckpt, CP_NAT_BITS_FLAG) &&
> + (cp_payload + F2FS_CP_PACKS +
> + NR_CURSEG_PERSIST_TYPE + nat_bits_blocks >= blocks_per_seg)) {
> + f2fs_warn(sbi, "Insane cp_payload: %u, nat_bits_blocks: %u)",
> + cp_payload, nat_bits_blocks);
> + return -EFSCORRUPTED;
> + }
> +
> if (unlikely(f2fs_cp_error(sbi))) {
> f2fs_err(sbi, "A bug case: need to run fsck");
> return 1;
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists