Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1499551

[PATCH 3.4 069/125] dm btree: fix leak of bufio-backed block in btree_split_sibling error path

From lizf@kernel.org
Newsgroups linux.kernel
Subject [PATCH 3.4 069/125] dm btree: fix leak of bufio-backed block in btree_split_sibling error path
Date 2016-10-12 14:50 +0200
Message-ID <srr8S-4rr-25@gated-at.bofh.it> (permalink)
References <srqZb-4nM-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mike Snitzer <snitzer@redhat.com>

3.4.113-rc1 review patch.  If anyone has any objections, please let me know.

------------------


commit 30ce6e1cc5a0f781d60227e9096c86e188d2c2bd upstream.

The block allocated at the start of btree_split_sibling() is never
released if later insert_at() fails.

Fix this by releasing the previously allocated bufio block using
unlock_block().

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
---
 drivers/md/persistent-data/dm-btree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index be86d59..77c615e 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -450,8 +450,10 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root,
 
 	r = insert_at(sizeof(__le64), pn, parent_index + 1,
 		      le64_to_cpu(rn->keys[0]), &location);
-	if (r)
+	if (r) {
+		unlock_block(s->info, right);
 		return r;
+	}
 
 	if (key < le64_to_cpu(rn->keys[0])) {
 		unlock_block(s->info, right);
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.4 069/125] dm btree: fix leak of bufio-backed block in btree_split_sibling error path lizf@kernel.org - 2016-10-12 14:50 +0200

csiph-web