Skip to content
Snippets Groups Projects
Commit c1864d12 authored by Ming Lei's avatar Ming Lei
Browse files

block: make bioset_exit() fully resilient against being called twice

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2083917

commit 605f7415
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sun May 29 07:13:09 2022 -0600

    block: make bioset_exit() fully resilient against being called twice

    Most of bioset_exit() is fine being called twice, as it clears the
    various allocations etc when they are freed. The exception is
    bio_alloc_cache_destroy(), which does not clear ->cache when it has
    freed it.

    This isn't necessarily a bug, but can be if buggy users does call the
    exit path more then once, or with just a memset() bioset which has
    never been initialized. dm appears to be one such user.

    Fixes: be4d234d ("bio: add allocation cache abstraction")
    Link: https://lore.kernel.org/linux-block/YpK7m+14A+pZKs5k@casper.infradead.org/


Reported-by: default avatarMatthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>

Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
parent 63e46f8e
No related branches found
No related tags found
No related merge requests found
......@@ -723,6 +723,7 @@ static void bio_alloc_cache_destroy(struct bio_set *bs)
bio_alloc_cache_prune(cache, -1U);
}
free_percpu(bs->cache);
bs->cache = NULL;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment