The patch titled Subject: fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block() has been added to the -mm tree. Its filename is fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> Subject: 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. Link: http://lkml.kernel.org/r/874lilcu67.fsf@xxxxxxxxxxxxxxxxxx Signed-off-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> Reported-by: Anatoly Trosinenko <anatoly.trosinenko@xxxxxxxxx> Tested-by: Anatoly Trosinenko <anatoly.trosinenko@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/fat/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff -puN fs/fat/inode.c~fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block fs/fat/inode.c --- a/fs/fat/inode.c~fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block +++ a/fs/fat/inode.c @@ -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); _ Patches currently in -mm which might be from hirofumi@xxxxxxxxxxxxxxxxxx are fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html