Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46652a86 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Rusty Russell
Browse files

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.

To fix, cleanup in reverse order of initialization.

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarMing Lei <ming.lei@canonical.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent cbd7f8d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -871,8 +871,8 @@ static int __init init(void)

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);