From: Michael S. Tsirkin Date: Thu, 23 Oct 2014 15:57:19 +0000 (+0300) Subject: virtio_blk: fix race at module removal X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=38f37b578f7d62a827d6f42e21d55bf428f9af8e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git virtio_blk: fix race at module removal If a device appears while module is being removed, driver will get a callback after we've given up on the major number. In theory this means this major number can get reused by something else, resulting in a conflict. Signed-off-by: Michael S. Tsirkin Reviewed-by: Cornelia Huck --- diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 055f3df0b4d0..1f8b111c5dab 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -884,8 +884,8 @@ out_destroy_workqueue: static void __exit fini(void) { - unregister_blkdev(major, "virtblk"); unregister_virtio_driver(&virtio_blk); + unregister_blkdev(major, "virtblk"); destroy_workqueue(virtblk_wq); } module_init(init);