Commit 063b1f21 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by David Sterba

btrfs: fix a memory allocation failure test in btrfs_submit_direct

After allocation 'dip' is tested instead of 'dip->csums'.  Fix it.

Fixes: 642c5d34 ("btrfs: allocate the btrfs_dio_private as part of the iomap dio bio")
CC: stable@vger.kernel.org # 5.19+
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 76a66ba1
...@@ -7980,7 +7980,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter, ...@@ -7980,7 +7980,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter,
*/ */
status = BLK_STS_RESOURCE; status = BLK_STS_RESOURCE;
dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS); dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS);
if (!dip) if (!dip->csums)
goto out_err; goto out_err;
status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums); status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment