Skip to content

Commit 063b1f2

Browse files
tititiou36kdave
authored andcommitted
btrfs: fix a memory allocation failure test in btrfs_submit_direct
After allocation 'dip' is tested instead of 'dip->csums'. Fix it. Fixes: 642c5d3 ("btrfs: allocate the btrfs_dio_private as part of the iomap dio bio") CC: [email protected] # 5.19+ Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 76a66ba commit 063b1f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7980,7 +7980,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter,
79807980
*/
79817981
status = BLK_STS_RESOURCE;
79827982
dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS);
7983-
if (!dip)
7983+
if (!dip->csums)
79847984
goto out_err;
79857985

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

0 commit comments

Comments
 (0)