lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVMP9yLfUhwh6MH=q6a11Z8AeJ8aso7R+LNb-QoDfD5UVw@mail.gmail.com>
Date:	Fri, 24 Oct 2014 10:13:01 +0800
From:	Ming Lei <tom.leiming@...il.com>
To:	"Michael S. Tsirkin" <mst@...hat.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Linux Virtualization <virtualization@...ts.linux-foundation.org>
Subject: Re: [PATCH] virtio_blk: fix race at module removal

On Fri, Oct 24, 2014 at 12:12 AM, Michael S. Tsirkin <mst@...hat.com> wrote:
> 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.

Yes, there is a tiny race window.

>
> To fix, cleanup in reverse order of initialization.

Reviewed-by: Ming Lei <ming.lei@...onical.com>

> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> ---
>  drivers/block/virtio_blk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 56aadbc..adfba9f 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -883,8 +883,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);

Thanks,
-- 
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ