]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm btree: fix leak of bufio-backed block in btree_split_beneath error path
authorMike Snitzer <snitzer@redhat.com>
Thu, 22 Oct 2015 14:56:40 +0000 (10:56 -0400)
committerZefan Li <lizefan@huawei.com>
Wed, 27 Apr 2016 10:55:29 +0000 (18:55 +0800)
commit 4dcb8b57df3593dcb20481d9d6cf79d1dc1534be upstream.

btree_split_beneath()'s error path had an outstanding FIXME that speaks
directly to the potential for _not_ cleaning up a previously allocated
bufio-backed block.

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>
Acked-by: Joe Thornber <thornber@redhat.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/md/persistent-data/dm-btree.c

index dddd5a47f97d4bf623ad362d5d4b7d9d18259abc..be86d59eaa9005b58f2783183d2c71eed0fdb101 100644 (file)
@@ -502,7 +502,7 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key)
 
        r = new_block(s->info, &right);
        if (r < 0) {
-               /* FIXME: put left */
+               unlock_block(s->info, left);
                return r;
        }