mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
block: make bioset_exit() fully resilient against being called twice
[ Upstream commit605f7415ec
] 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:be4d234d7a
("bio: add allocation cache abstraction") Link: https://lore.kernel.org/linux-block/YpK7m+14A+pZKs5k@casper.infradead.org/ Reported-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b2d60329a0
commit
b79f0b14a5
1 changed files with 1 additions and 0 deletions
|
@ -693,6 +693,7 @@ static void bio_alloc_cache_destroy(struct bio_set *bs)
|
|||
bio_alloc_cache_prune(cache, -1U);
|
||||
}
|
||||
free_percpu(bs->cache);
|
||||
bs->cache = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue