Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4966b77 authored by Daniel J Blueman's avatar Daniel J Blueman Committed by Chris Mason
Browse files

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: default avatarDaniel J Blueman <daniel.blueman@gmail.com>
Acked-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent ea8efc74
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6058,6 +6058,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
	if (!skip_sum) {
		dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS);
		if (!dip->csums) {
			kfree(dip);
			ret = -ENOMEM;
			goto free_ordered;
		}