Skip to content

Commit

Permalink
dm btree: fix leak of bufio-backed block in btree_split_sibling error…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
Mike Snitzer committed Dec 2, 2015
1 parent 31ade3b commit 30ce6e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/persistent-data/dm-btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 30ce6e1

Please sign in to comment.