Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp937358pxb; Fri, 15 Apr 2022 15:59:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTc39RBuiIeVsVpw452RYpfRCGYq6Z465fKY84tsjZeOW774JhbzmZ/oxN789YuMdDcuPX X-Received: by 2002:a17:906:264d:b0:6e8:cf61:4539 with SMTP id i13-20020a170906264d00b006e8cf614539mr876590ejc.546.1650063595736; Fri, 15 Apr 2022 15:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650063595; cv=none; d=google.com; s=arc-20160816; b=x0m+TSMlZQtBUINA1IYNx3uoClQXWV8fGQWGOqG30GvSBlOJPwOkGlgcQfp3WBjgCk BmFXvvXnIQqiB4h0W5NpMOxnVcPzjnJqQwAzU23Ocl6+xmi84pqhHMXo6f01hQ2H06jT CT1IjwCurADVERUruoJ6VgMqS8DKtZM70uis1nO7jj5WU++5LK3HxRKeKzp9qTCGjGNu hOHxOTJsL/Kfxg7WW33DvIBjlWz4XX0M35ghSYa541h4EnHcVrkqI61yoM/3J5NyhJLp t/916PoZbdzMtaiv/jAldQwZguaU9k+vKVfuvfCum0sl59ENZmxCUIyRBbkgpZjPU3Ta DxlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=x1+twxcNLtWV1O5ac2LQi8PLgLXHlVRzgri2odzohFg=; b=tAwu4wgWj04kW50G2M34HJcc4KXRQJ969nciRdseiE6c+Yt2pRiWMIrd3Pcz0IHywm n+jSrugsQ8N1G3n1M95GLl3Xi53ngFL35JBtPzseEU3KFqdgK4Co9l2u4v9k2XE2fSUB 80K/T8bf5OSK82GddfNBLQJ1wzbCPRHQwgnX2SnoAFwy0vWybjTXQNyKLuUyxXHUJ+gL 8pB+aSaCLTZvT9q8GkPNTtkfiPQg7rp6I/aXJ/iF3hzJPiD7zFlR5E/DB6xg3ItqvhGi lSCKhrdu3mqCyK/cTNm3/Y0stPcOXXpE1AqRc8h82tTJXRX5QOa4FyGK8TpNJ1Z7S5NY CqtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a05640226cc00b0041d7f63a4a0si2064943edd.417.2022.04.15.15.59.29; Fri, 15 Apr 2022 15:59:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353931AbiDONXU (ORCPT + 99 others); Fri, 15 Apr 2022 09:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352586AbiDONXS (ORCPT ); Fri, 15 Apr 2022 09:23:18 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27DE1AAC83 for ; Fri, 15 Apr 2022 06:20:45 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 23FDJ3rw021361-23FDJ3s1021361 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Fri, 15 Apr 2022 21:19:07 +0800 From: Dongliang Mu To: Jaegeuk Kim , Chao Yu Cc: Dongliang Mu , syzbot+763ae12a2ede1d99d4dc@syzkaller.appspotmail.com, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v2] fs: f2fs: remove WARN_ON in f2fs_is_valid_blkaddr Date: Fri, 15 Apr 2022 21:19:02 +0800 Message-Id: <20220415131902.55028-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dongliang Mu Syzbot triggers two WARNs in f2fs_is_valid_blkaddr and __is_bitmap_valid. For example, in f2fs_is_valid_blkaddr, if type is DATA_GENERIC_ENHANCE or DATA_GENERIC_ENHANCE_READ, it invokes WARN_ON if blkaddr is not in the right range. The call trace is as follows: f2fs_get_node_info+0x45f/0x1070 read_node_page+0x577/0x1190 __get_node_page.part.0+0x9e/0x10e0 __get_node_page f2fs_get_node_page+0x109/0x180 do_read_inode f2fs_iget+0x2a5/0x58b0 f2fs_fill_super+0x3b39/0x7ca0 Fix these two WARNs by replacing WARN_ON with dump_stack. Reported-by: syzbot+763ae12a2ede1d99d4dc@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu --- v1->v2: as suggested by Chao Yu, change WARN_ON to dump_stack fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index f5366feea82d..4dfae0cc6b16 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -158,7 +158,7 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr, f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", blkaddr, exist); set_sbi_flag(sbi, SBI_NEED_FSCK); - WARN_ON(1); + dump_stack(); } return exist; } @@ -196,7 +196,7 @@ bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi, f2fs_warn(sbi, "access invalid blkaddr:%u", blkaddr); set_sbi_flag(sbi, SBI_NEED_FSCK); - WARN_ON(1); + dump_stack(); return false; } else { return __is_bitmap_valid(sbi, blkaddr, type); -- 2.25.1