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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7980,7 +7980,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter,
		 */
		status = BLK_STS_RESOURCE;
		dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS);
		if (!dip)
		if (!dip->csums)
			goto out_err;

		status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums);