Skip to content
Commit d6c73964 authored by Anatoliy Glagolev's avatar Anatoliy Glagolev Committed by Jens Axboe
Browse files

bsg: fix race of bsg_open and bsg_unregister



The existing implementation allows races between bsg_unregister and
bsg_open paths. bsg_unregister and request_queue cleanup and deletion
may start and complete right after bsg_get_device (in bsg_open path)
retrieves bsg_class_device and releases the mutex. Then bsg_open path
touches freed memory of bsg_class_device and request_queue.

One possible fix is to hold the mutex all the way through bsg_get_device
instead of releasing it after bsg_class_device retrieval.

Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-Off-By: default avatarAnatoliy Glagolev <glagolig@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent be7f99c5
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