Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp163432ybp; Thu, 3 Oct 2019 11:41:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHiys0hdY+lTwt+UdTJprhnxADRGbPhaaYHoxgWhYrv/rF91tAEeChdL4hDYy9w515GPLF X-Received: by 2002:aa7:db02:: with SMTP id t2mr11010869eds.252.1570128090878; Thu, 03 Oct 2019 11:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570128090; cv=none; d=google.com; s=arc-20160816; b=iiDq7qHLS+3JxJfPYyT1JVjUBqO9zyp/Sp6Cyuebgghw62LGcrFXH0UG+P3V1RKdPt Gj406E8CPRkeLiI9mLHyTu/dw7de0pshkRbFXFz0ygIG5cYtewYCeQ4t9OJjb689H6l7 JG7Ch3iByjbhJ09TJDO09fiYorcWWuDgM+avyVnLN//ZFV+1vGr+VwVqL8/pnVuXJAiW VW/Q8ffiUdIuniEhRzc3xSq+Hs4SdIup6uknZsEZs9d4fkxB73JWq3D1R+7aX6CAxyKz 8MDyQU8ZiSWgSYXOZWjymB1XYwzBU44am5ph+IYgW5iqo/hZhMhbiyCfEwzWg2I9r+EN +eow== 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=KVYsY8BIQ3PGGr3sPVhudXxaHI3xi9A4qkW53lgpst0=; b=X2RNRzDecQ1lgTicSZPX7lxqG7Bmou2sUhLQ2BlHu0+ZHpbjBqCz6+RfEehYMWOgR+ TMPxjGKyja3vH+d4ey/KBMUXi4Q5Xw8xQAuK6wgHk6TAHcSYWvmrszjsD8EO8HeAhSzt wnC7Uzp1rXcDSneWHWHVLylTG8B4Cm2TMHcoKt0gWXXXhwAynUfEfEgRNQ2G+xnxGTP2 OHtA0ROvUqe7kDpcaP7TLDfc+LOjY5cIJaz5105fDvyBzEFZ0NwvIwvOyUrdPSLLpz/Z I5/WMYVdpbAGTYBwvVjXSOU+cFAE5zCrGtksGgKUVkTHA938eRw7PTxRJai9tX1rrGAH aslA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="o/qUl32G"; 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 f47si2122606ede.263.2019.10.03.11.41.06; Thu, 03 Oct 2019 11:41:30 -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="o/qUl32G"; 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 S1731667AbfJCQA7 (ORCPT + 99 others); Thu, 3 Oct 2019 12:00:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:44922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728786AbfJCQAz (ORCPT ); Thu, 3 Oct 2019 12:00:55 -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 5A3AF21848; Thu, 3 Oct 2019 16:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118454; bh=i96ov6Rmi4+Atr3GicTb5fGFgF2PeBsIq374ck8lhDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o/qUl32GgomMzMqMfxy44Oy+UUwRpuyZaAFJdD5aicsuYZVWF7OmQZeZO8QZ/PFUI vhYcnxGWacMoreoyfElXAGKQXhbeR+AgCHZOjfxftOxVljHRA/085EuxufQO0vNPF3 2Q9Jy1Wvaz4tcnSBqfvZ0LY8YCWBADelizJaNvWw= 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.9 018/129] Revert "f2fs: avoid out-of-range memory access" Date: Thu, 3 Oct 2019 17:52:21 +0200 Message-Id: <20191003154327.439442229@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154318.081116689@linuxfoundation.org> References: <20191003154318.081116689@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 c983f7d28f033..2fb99a081de8f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1709,11 +1709,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