Commit d6671b05 authored by Mike Snitzer's avatar Mike Snitzer Committed by Greg Kroah-Hartman

dm btree: fix leak of bufio-backed block in btree_split_sibling error path

commit 30ce6e1c 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: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent daaf3fd9
......@@ -455,8 +455,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment