Skip to content
Snippets Groups Projects
Commit 8468f450 authored by Coly Li's avatar Coly Li Committed by Jens Axboe
Browse files

bcache: fix use-after-free problem in bcache_device_free()


In bcache_device_free(), pointer disk is referenced still in
ida_simple_remove() after blk_cleanup_disk() gets called on this
pointer. This may cause a potential panic by use-after-free on the
disk pointer.

This patch fixes the problem by calling blk_cleanup_disk() after
ida_simple_remove().

Fixes: bc70852f ("bcache: convert to blk_alloc_disk/blk_cleanup_disk")
Signed-off-by: default avatarColy Li <colyli@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: stable@vger.kernel.org # v5.14+
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211103064917.67383-1-colyli@suse.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 00c5495c
No related branches found
No related tags found
Loading
Loading
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