lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 044/593] ext4: fix overflow in ext4_iomap_alloc()
    Date
    From: Jan Kara <jack@suse.cz>

    commit d0b040f5f2557b2f507c01e88ad8cff424fdc6a9 upstream.

    A code in iomap alloc may overflow block number when converting it to
    byte offset. Luckily this is mostly harmless as we will just use more
    expensive method of writing using unwritten extents even though we are
    writing beyond i_size.

    Cc: stable@kernel.org
    Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")
    Signed-off-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20210412102333.2676-4-jack@suse.cz
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/ext4/inode.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/fs/ext4/inode.c
    +++ b/fs/ext4/inode.c
    @@ -3419,7 +3419,7 @@ retry:
    * i_disksize out to i_size. This could be beyond where direct I/O is
    * happening and thus expose allocated blocks to direct I/O reads.
    */
    - else if ((map->m_lblk * (1 << blkbits)) >= i_size_read(inode))
    + else if (((loff_t)map->m_lblk << blkbits) >= i_size_read(inode))
    m_flags = EXT4_GET_BLOCKS_CREATE;
    else if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
    m_flags = EXT4_GET_BLOCKS_IO_CREATE_EXT;

    \
     
     \ /
      Last update: 2021-07-12 08:39    [W:4.027 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site