All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: [kernel BUG at fs/fat/inode.c:162] when writing to a broken VFAT
Date: Sun, 3 Jun 2018 16:46:27 +0300	[thread overview]
Message-ID: <CAE5jQCfu4i5OQbgE-szs8bGzYoTg2VfOeKKh8+R8yKEfxww=6Q@mail.gmail.com> (raw)
In-Reply-To: <874lilcu67.fsf@mail.parknet.co.jp>

Thank you, it works!

сб, 2 июн. 2018 г. в 14:19, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>:
>
> Anatoly Trosinenko <anatoly.trosinenko@gmail.com> writes:
>
> > Description:
> >
> > Writing to some file on a broken VFAT partition causes kernel bug
>
> Thanks. This patch should fix this issue.
> --
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
>
>
> [PATCH] fat: Use fat_fs_error() instead of BUG_ON() in __fat_get_block()
>
> If file size and FAT cluster chain is not matched (corrupted image),
> we can hit BUG_ON(!phys) in __fat_get_block().
>
> So, use fat_fs_error() instead.
>
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
> ---
>
>  fs/fat/inode.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff -puN fs/fat/inode.c~vfat-dont-bugon fs/fat/inode.c
> --- linux/fs/fat/inode.c~vfat-dont-bugon        2018-06-02 20:15:04.441920069 +0900
> +++ linux-hirofumi/fs/fat/inode.c       2018-06-02 20:15:04.442920067 +0900
> @@ -158,8 +158,13 @@ static inline int __fat_get_block(struct
>         err = fat_bmap(inode, iblock, &phys, &mapped_blocks, create, false);
>         if (err)
>                 return err;
> +       if (!phys) {
> +               fat_fs_error(sb,
> +                            "invalid FAT chain (i_pos %lld, last_block %ld)",
> +                            MSDOS_I(inode)->i_pos, last_block);
> +               return -EIO;
> +       }
>
> -       BUG_ON(!phys);
>         BUG_ON(*max_blocks != mapped_blocks);
>         set_buffer_new(bh_result);
>         map_bh(bh_result, sb, phys);
> _

-- 
Anatoly

      reply	other threads:[~2018-06-03 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01  9:45 Anatoly Trosinenko
2018-06-02 11:19 ` OGAWA Hirofumi
2018-06-03 13:46   ` Anatoly Trosinenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAE5jQCfu4i5OQbgE-szs8bGzYoTg2VfOeKKh8+R8yKEfxww=6Q@mail.gmail.com' \
    --to=anatoly.trosinenko@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: PROBLEM: [kernel BUG at fs/fat/inode.c:162] when writing to a broken VFAT' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.