Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5846485ybn; Sun, 29 Sep 2019 07:00:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCmQkf2PRj9c6mIrLCgAjvT7PPMyLrtjLtcxkQNWKv8eAcOQeUOk70eb0gj3HWFVKFEdeU X-Received: by 2002:aa7:df16:: with SMTP id c22mr14714692edy.22.1569765651404; Sun, 29 Sep 2019 07:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569765651; cv=none; d=google.com; s=arc-20160816; b=sSDHBhMCeFITiEwapjIWlzx6o+JszPY8frJ0Ygmnplzw8OjLSOJ1ENjEXPeNAARtbo 9MfEVZMsDDESPuNJiOkKJxYcvbdLxuSiranI5Ggr99fvnP1iBsrdq5+FceC7dZik11H/ 3Zk/vrjly8FBUGGV4xLY+pBTq1Z+pLk/95GOAkuWbjbdeXIgFZIHFf8XJNFG/rHdasu2 iGKmFx63GSZ4i9D8qWfeoAEZ2KOMg1rtpfq59x+6Ko1VIud1CfLXZXmRnsPSxVK5YT80 SyQ7aK2jZ37IO4QINevzozu6ZSFmlKY6lQB3l8Tm12M2pHkg1HbTlVTweum6lHjdVY60 CMOw== 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=pWBVNgIap0VXOyqTYpS4rBirvFgXXhIa6e/tgGp84yA=; b=0VEgvGc7/IseWxPOuPD4aQIjI7pvQ4uLNZIkVwdWTaVCRkIcCr/BRYesIPYOB5piDy CvXfLG7xHH07tO6cXl3udRI7OhqqOTHXqHlA2E/r+fn9vefMlDSvyslMgg3k2huaKah4 mpZjo9PlKh1rke4cUPSaSGU25iMOicZHEQs4+jt5YlQwX79mQr5g69uRY2P7U4w6KuhO JIVEzCn5Xl1WwmznovUl607ZHhFnV0w0iGexCNLqrJNWqWgeA/XDc4k+0/NjRJr6562B grtCF5ngKyXYTroKiEGuz3SVMKr8XE3ZlXXqfJjuVRYOMexBPkGdREJWeDY6NjAbMPHf G31g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iUMHNGjT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si5324764eda.104.2019.09.29.07.00.27; Sun, 29 Sep 2019 07:00:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iUMHNGjT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729636AbfI2N7D (ORCPT + 99 others); Sun, 29 Sep 2019 09:59:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:39986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729623AbfI2N7B (ORCPT ); Sun, 29 Sep 2019 09:59:01 -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 DFC7D21882; Sun, 29 Sep 2019 13:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765540; bh=wcql+Rm0lSjLYTXoAkhshTf50QhH/nYNfnIRT12myQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUMHNGjTet7ZV7zwe5l3qc+eEz5Uf6YFvedsxoYun8wkPRUbRlIbmHnp0k+tJYUBe LFzT2DyrV17MaUxj2YnfII2j6sbLCJr2iUoYp2EnejNkYsMtMpU2BgP9I4aJZj1nJW TmlkxTeDTlI6o7Fn8Kjtr0mgRjLu2JQqp5+rlIHo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.19 50/63] Revert "f2fs: avoid out-of-range memory access" Date: Sun, 29 Sep 2019 15:54:23 +0200 Message-Id: <20190929135040.107264551@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190929135031.382429403@linuxfoundation.org> References: <20190929135031.382429403@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: Chao Yu [ Upstream commit a37d0862d17411edb67677a580a6f505ec2225f6 ] As Pavel Machek reported: "We normally use -EUCLEAN to signal filesystem corruption. Plus, it is good idea to report it to the syslog and mark filesystem as "needing fsck" if filesystem can do that." Still we need improve the original patch with: - use unlikely keyword - add message print - return EUCLEAN However, after rethink this patch, I don't think we should add such condition check here as below reasons: - We have already checked the field in f2fs_sanity_check_ckpt(), - If there is fs corrupt or security vulnerability, there is nothing to guarantee the field is integrated after the check, unless we do the check before each of its use, however no filesystem does that. - We only have similar check for bitmap, which was added due to there is bitmap corruption happened on f2fs' runtime in product. - There are so many key fields in SB/CP/NAT did have such check after f2fs_sanity_check_{sb,cp,..}. So I propose to revert this unneeded check. This reverts commit 56f3ce675103e3fb9e631cfb4131fc768bc23e9a. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/segment.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 92f72bb5aff43..8fc3edb6760c2 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3261,11 +3261,6 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi) seg_i = CURSEG_I(sbi, i); segno = le32_to_cpu(ckpt->cur_data_segno[i]); blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]); - if (blk_off > ENTRIES_IN_SUM) { - f2fs_bug_on(sbi, 1); - f2fs_put_page(page, 1); - return -EFAULT; - } seg_i->next_segno = segno; reset_curseg(sbi, i, 0); seg_i->alloc_type = ckpt->alloc_type[i]; -- 2.20.1