• Christoph Hellwig's avatar
    btrfs: fix iomap_begin length for nocow writes · 7833b865
    Christoph Hellwig authored
    can_nocow_extent can reduce the len passed in, which needs to be
    propagated to btrfs_dio_iomap_begin so that iomap does not submit
    more data then is mapped.
    
    This problems exists since the btrfs_get_blocks_direct helper was added
    in commit c5794e51 ("btrfs: Factor out write portion of
    btrfs_get_blocks_direct"), but the ordered_extent splitting added in
    commit b73a6fd1 ("btrfs: split partial dio bios before submit")
    added a WARN_ON that made a syzkaller test fail.
    
    Reported-by: syzbot+ee90502d5c8fd1d0dd93@syzkaller.appspotmail.com
    Fixes: c5794e51
    
     ("btrfs: Factor out write portion of btrfs_get_blocks_direct")
    CC: stable@vger.kernel.org # 6.1+
    Tested-by: syzbot+ee90502d5c8fd1d0dd93@syzkaller.appspotmail.com
    Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    7833b865
inode.c 312 KB