btrfs: fix free dip and dip->csums twice
bio_endio() will free dip and dip->csums, so dip and dip->csums twice will be freed twice. Fix it. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
784b4e29a2
commit
0c56fa9662
@ -5731,7 +5731,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
|
|||||||
|
|
||||||
ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
|
ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_err;
|
goto free_ordered;
|
||||||
|
|
||||||
if (write && !skip_sum) {
|
if (write && !skip_sum) {
|
||||||
ret = btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info,
|
ret = btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info,
|
||||||
@ -5740,7 +5740,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
|
|||||||
__btrfs_submit_bio_start_direct_io,
|
__btrfs_submit_bio_start_direct_io,
|
||||||
__btrfs_submit_bio_done);
|
__btrfs_submit_bio_done);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_err;
|
goto free_ordered;
|
||||||
return;
|
return;
|
||||||
} else if (!skip_sum)
|
} else if (!skip_sum)
|
||||||
btrfs_lookup_bio_sums_dio(root, inode, bio,
|
btrfs_lookup_bio_sums_dio(root, inode, bio,
|
||||||
@ -5748,11 +5748,8 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
|
|||||||
|
|
||||||
ret = btrfs_map_bio(root, rw, bio, 0, 1);
|
ret = btrfs_map_bio(root, rw, bio, 0, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_err;
|
goto free_ordered;
|
||||||
return;
|
return;
|
||||||
out_err:
|
|
||||||
kfree(dip->csums);
|
|
||||||
kfree(dip);
|
|
||||||
free_ordered:
|
free_ordered:
|
||||||
/*
|
/*
|
||||||
* If this is a write, we need to clean up the reserved space and kill
|
* If this is a write, we need to clean up the reserved space and kill
|
||||||
|
Loading…
Reference in New Issue
Block a user