]> git.baikalelectronics.ru Git - kernel.git/commit
ublk_drv: cancel device even though disk isn't up
authorMing Lei <ming.lei@redhat.com>
Sat, 30 Jul 2022 09:27:47 +0000 (17:27 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Aug 2022 03:13:40 +0000 (21:13 -0600)
commit3129330cdecc70633ab345354e340a5faee3c325
tree22e1ad079275eaa57510e5253528625b9446d1ea
parentab64e78870bb1148bc8ca948669cff89a648dd0e
ublk_drv: cancel device even though disk isn't up

Each ublk queue is started before adding disk, we have to cancel queues in
ublk_stop_dev() so that ubq daemon can be exited, otherwise DEL_DEV command
may hang forever.

Also avoid to cancel queues two times by checking if queue is ready,
otherwise use-after-free on io_uring may be triggered because ublk_stop_dev
is called by ublk_remove() too.

Fixes: c72ffe88841a ("ublk_drv: add io_uring based userspace block driver")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220730092750.1118167-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c