Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1484804pxb; Sun, 19 Sep 2021 19:44:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb/e1wy5ucIIl1SYd1nENDHS4CB94itAWawyumW0envq8tGkU+FRoc1X1jGdMTmQcg6nNR X-Received: by 2002:a17:907:1b1b:: with SMTP id mp27mr25398235ejc.538.1632105867486; Sun, 19 Sep 2021 19:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632105867; cv=none; d=google.com; s=arc-20160816; b=jCHQEKO6CdhzQYIswo9ionaCXslOkuWn0Mw4/WrF7m1hoq7/PSXcb2QbIQjuL8IvJP qerFv7B++SkXjjLFtvdW5iqMd+nL0jimKFuFB/xXT5Dwu09lVRcU3+luuFS+XOADCf9u zBv3rcUFgzxnuQFAqoHMowsoAghY5pa4kHDYqmNIcntnKONEgdYFQuW5vsTUPSZoJEmr keLApiwy8qLF3a6fJBGzi3szHtxdAiXbDY5frgG9dWA2CFPee1p2Z9hI/lZMRIjJ9rOi HPWSGvQYP4B26VTZ9VkjhCBRyVu604tIoRqG7mQFxxjjAtHy+zamOwjMm6+uFnzvLIEI kFAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=WQKWayrSqXB8mwbwBwSlec4mrEawFUyqb7sdTNbVxww=; b=rC1KVIGtsuw4mPRz5rVUQCmqGaOXrUoMsZA+1qvpj3cZjgJB9Id8rTCKFgIVhOJKuV q6wHVephw2ijr4OQi8jz5DCAZJ/elb8W39aSZO/n37V85k3pttMPSJmkZ3hU8qPk8YBl 2bXpvc+HivWzMjidpzx0YMAfarNOgwFcKVSBsw8bgM7wn7nV+0pcjMDKdhLXxpE6l8FS oVESjNiXrPE7l/m6qfvwWUaqWTH9sTeHeIRzlb7GZiuXXs1tSDa1oHFf/FaxqL4LCPvw ws6J3sRK8JA9Cv2jUcvYzFJ0uIFplPkm6yqviICoSge11+FZleEi0cP1Hqf0jbvl4eTn z1sA== ARC-Authentication-Results: i=1; mx.google.com; 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 s2si1915014edc.530.2021.09.19.19.43.43; Sun, 19 Sep 2021 19:44:27 -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; 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 S231444AbhISTIF (ORCPT + 99 others); Sun, 19 Sep 2021 15:08:05 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:34478 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbhISTIE (ORCPT ); Sun, 19 Sep 2021 15:08:04 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 202401C0B79; Sun, 19 Sep 2021 21:06:38 +0200 (CEST) Date: Sun, 19 Sep 2021 21:06:38 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, stable@kernel.org, Chao Yu , Jaegeuk Kim Subject: Re: [PATCH 5.10 045/306] f2fs: fix to do sanity check for sb/cp fields correctly Message-ID: <20210919190638.GA12836@amd> References: <20210916155753.903069397@linuxfoundation.org> <20210916155755.480312003@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline In-Reply-To: <20210916155755.480312003@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --J/dobhs11T7y2rNN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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; > } > =20 > + nat_blocks =3D nat_segs << log_blocks_per_seg; > + nat_bits_bytes =3D nat_blocks / BITS_PER_BYTE; > + nat_bits_blocks =3D 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 >=3D 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; >=20 --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmFHij4ACgkQMOfwapXb+vInUACgqfnS2ENLFCITtklR3ryxbyTN wzcAoKMtY+fR5/iYZYJWvuMSK8qDrvKT =7OU5 -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--