summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2015-11-24 00:24:45 +0300
committerMike Snitzer <snitzer@redhat.com>2015-12-02 21:20:34 +0300
commit30ce6e1cc5a0f781d60227e9096c86e188d2c2bd (patch)
tree4d1217d25ff2d2e6db70e11a04ce52f82a781cb8 /drivers/md
parent31ade3b83e1821da5fbb2f11b5b3d4ab2ec39db8 (diff)
downloadlinux-30ce6e1cc5a0f781d60227e9096c86e188d2c2bd.tar.xz
dm btree: fix leak of bufio-backed block in btree_split_sibling error path
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> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/persistent-data/dm-btree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index c573402033b2..0918a7c5f809 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -473,8 +473,10 @@ static int btree_split_sibling(struct shadow_spine *s, unsigned parent_index,
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);