提交 46652a86 编写于 作者: M Michael S. Tsirkin 提交者: Rusty Russell

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: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NMing Lei <ming.lei@canonical.com>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 cbd7f8d6
...@@ -871,8 +871,8 @@ static int __init init(void) ...@@ -871,8 +871,8 @@ static int __init init(void)
static void __exit fini(void) static void __exit fini(void)
{ {
unregister_blkdev(major, "virtblk");
unregister_virtio_driver(&virtio_blk); unregister_virtio_driver(&virtio_blk);
unregister_blkdev(major, "virtblk");
destroy_workqueue(virtblk_wq); destroy_workqueue(virtblk_wq);
} }
module_init(init); module_init(init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册