diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2010-11-21 22:01:39 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-11-21 22:26:02 -0500 |
commit | 0c56fa9662927354255f2f64617d1de61fc03db9 (patch) | |
tree | d3e4afe5596c6ac844b8f84fbb5cd89c9a8d0cf8 /fs | |
parent | 784b4e29a26617589edd290dd2919735e190c06e (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5132c9af888a..8c027aa0020a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -5731,7 +5731,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode, | |||
5731 | 5731 | ||
5732 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); | 5732 | ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); |
5733 | if (ret) | 5733 | if (ret) |
5734 | goto out_err; | 5734 | goto free_ordered; |
5735 | 5735 | ||
5736 | if (write && !skip_sum) { | 5736 | if (write && !skip_sum) { |
5737 | ret = btrfs_wq_submit_bio(BTRFS_I(inode)->root->fs_info, | 5737 | 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, | |||
5740 | __btrfs_submit_bio_start_direct_io, | 5740 | __btrfs_submit_bio_start_direct_io, |
5741 | __btrfs_submit_bio_done); | 5741 | __btrfs_submit_bio_done); |
5742 | if (ret) | 5742 | if (ret) |
5743 | goto out_err; | 5743 | goto free_ordered; |
5744 | return; | 5744 | return; |
5745 | } else if (!skip_sum) | 5745 | } else if (!skip_sum) |
5746 | btrfs_lookup_bio_sums_dio(root, inode, bio, | 5746 | 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, | |||
5748 | 5748 | ||
5749 | ret = btrfs_map_bio(root, rw, bio, 0, 1); | 5749 | ret = btrfs_map_bio(root, rw, bio, 0, 1); |
5750 | if (ret) | 5750 | if (ret) |
5751 | goto out_err; | 5751 | goto free_ordered; |
5752 | return; | 5752 | return; |
5753 | out_err: | ||
5754 | kfree(dip->csums); | ||
5755 | kfree(dip); | ||
5756 | free_ordered: | 5753 | free_ordered: |
5757 | /* | 5754 | /* |
5758 | * If this is a write, we need to clean up the reserved space and kill | 5755 | * If this is a write, we need to clean up the reserved space and kill |