diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c index db2fd726..c1d0e6f5 100644 --- a/lib/ext2fs/bmap.c +++ b/lib/ext2fs/bmap.c @@ -321,6 +321,13 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, if (ext2fs_file_block_offset_too_big(fs, inode, block)) return EXT2_ET_FILE_TOO_BIG; + /* + * If an inode has inline data, that means that it doesn't have + * any blocks and we shouldn't map any blocks for it. + */ + if (inode->i_flags & EXT4_INLINE_DATA_FL) + return EXT2_ET_INLINE_DATA_NO_BLOCK; + if (!block_buf) { retval = ext2fs_get_array(2, fs->blocksize, &buf); if (retval) diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in index a7c8902f..7638470c 100644 --- a/lib/ext2fs/ext2_err.et.in +++ b/lib/ext2fs/ext2_err.et.in @@ -506,4 +506,7 @@ ec EXT2_ET_MISSING_EA_FEATURE, ec EXT2_ET_NO_INLINE_DATA, "Inode doesn't have inline data" +ec EXT2_ET_INLINE_DATA_NO_BLOCK, + "No block for an inode with inline data" + end