[3.11.y.z extended stable] Patch "Btrfs: fix memory leak of chunks' extent map" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Thu Jan 9 12:02:16 UTC 2014


This is a note to let you know that I have just added a patch titled

    Btrfs: fix memory leak of chunks' extent map

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From b73a9b9ddddc5c2e28ba94a15bd486004189a3e1 Mon Sep 17 00:00:00 2001
From: Liu Bo <bo.li.liu at oracle.com>
Date: Sun, 29 Sep 2013 10:33:16 +0800
Subject: Btrfs: fix memory leak of chunks' extent map

commit 7d3d1744f8a7d62e4875bd69cc2192a939813880 upstream.

As we're hold a ref on looking up the extent map, we need to drop the ref
before returning to callers.

Signed-off-by: Liu Bo <bo.li.liu at oracle.com>
Signed-off-by: Josef Bacik <jbacik at fusionio.com>
Signed-off-by: Chris Mason <chris.mason at fusionio.com>
Cc: David Sterba <dsterba at suse.cz>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 fs/btrfs/volumes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 78b8717..feb93fc 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4203,6 +4203,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
 		btrfs_emerg(fs_info, "Invalid mapping for %Lu-%Lu, got "
 			    "%Lu-%Lu\n", logical, logical+len, em->start,
 			    em->start + em->len);
+		free_extent_map(em);
 		return 1;
 	}

@@ -4384,6 +4385,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 		btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, "
 			   "found %Lu-%Lu\n", logical, em->start,
 			   em->start + em->len);
+		free_extent_map(em);
 		return -EINVAL;
 	}

--
1.8.3.2





More information about the kernel-team mailing list