summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2010-11-22 06:01:39 +0300
committerChris Mason <chris.mason@oracle.com>2010-11-22 06:26:02 +0300
commit0c56fa9662927354255f2f64617d1de61fc03db9 (patch)
treed3e4afe5596c6ac844b8f84fbb5cd89c9a8d0cf8
parent784b4e29a26617589edd290dd2919735e190c06e (diff)
downloadlinux-0c56fa9662927354255f2f64617d1de61fc03db9.tar.xz
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>
-rw-r--r--fs/btrfs/inode.c9
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,
ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
if (ret)
- goto out_err;
+ goto free_ordered;
if (write && !skip_sum) {
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_done);
if (ret)
- goto out_err;
+ goto free_ordered;
return;
} else if (!skip_sum)
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);
if (ret)
- goto out_err;
+ goto free_ordered;
return;
-out_err:
- kfree(dip->csums);
- kfree(dip);
free_ordered:
/*
* If this is a write, we need to clean up the reserved space and kill