aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorDaniel J Blueman <daniel.blueman@gmail.com>2011-03-09 11:46:42 -0500
committerChris Mason <chris.mason@oracle.com>2011-03-10 11:21:49 -0500
commitb4966b7770349deb05e3dd2bd2c65d2d044abbbb (patch)
tree79e281fde97b792eb732b5bde167c56939a6c67f /fs/btrfs/inode.c
parentea8efc74bd0402b4d5f663d007b4e25fa29ea778 (diff)
btrfs: fix dip leak
The btrfs DIO code leaks dip structs when dip->csums allocation fails; bio->bi_end_io isn't set at the point where the free_ordered branch is consequently taken, thus bio_endio doesn't call the function which would free it in the normal case. Fix. Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com> Acked-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 44b926646e33..e7a8303328b2 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6058,6 +6058,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
6058 if (!skip_sum) { 6058 if (!skip_sum) {
6059 dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS); 6059 dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS);
6060 if (!dip->csums) { 6060 if (!dip->csums) {
6061 kfree(dip);
6061 ret = -ENOMEM; 6062 ret = -ENOMEM;
6062 goto free_ordered; 6063 goto free_ordered;
6063 } 6064 }