From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com ([209.85.128.196]:43136 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965577AbeFOKpg (ORCPT ); Fri, 15 Jun 2018 06:45:36 -0400 Received: by mail-wr0-f196.google.com with SMTP id d2-v6so9439792wrm.10 for ; Fri, 15 Jun 2018 03:45:35 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <0e4fb819-706c-6028-704b-393919ce8b26@i-love.sakura.ne.jp> References: <1525862104-3407-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <20180509160658.c37bef542a8ee5245a13917b@linux-foundation.org> <201805092346.w49NkINl045657@www262.sakura.ne.jp> <20180509165321.3b2b1313fde0f007c1a5a015@linux-foundation.org> <9ef86114-02d6-b243-203d-fbbdab95a6fa@I-love.SAKURA.ne.jp> <0e4fb819-706c-6028-704b-393919ce8b26@i-love.sakura.ne.jp> From: Tigran Aivazian Date: Fri, 15 Jun 2018 11:45:34 +0100 Message-ID: Subject: Re: [PATCH] bfs: add sanity check at bfs_fill_super(). To: Tetsuo Handa Cc: Dmitry Vyukov , Andrew Morton , linux-fsdevel , syzbot , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 14 June 2018 at 23:18, Tetsuo Handa wrote: > On 2018/06/15 4:00, Tigran Aivazian wrote: >> Ah, it turned out easier than I thought! The maximum number of inodes >> of a BFS filesystem is 512, so an inode map cannot be longer than 65 >> bytes. Well, we can be generous and restrict imap_len to 128 and be >> done with it :) >> >> Namely, if the calculated imap_len turns out to be greater than 128, >> then something is definitely wrong and the filesystem image should be >> rejected as corrupted. >> > So, the constraint is > > if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) || > le32_to_cpu(bfs_sb->s_end) > What_is_the_number_here) > > you can write the fix yourself... No, s_end has nothing to do with the number of inodes, it is to do with the actual data blocks. Yes, I am writing the fix myself and will test it under 4.17.1 to which I switched my Ubuntu desktop just now. Thanks, Tigran