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] [day] [month] [year] [list]
Date: Wed, 9 Aug 2023 09:43:04 +0800
From: Jason Wang <jasowang@...hat.com>
To: Dragos Tatulea <dtatulea@...dia.com>
Cc: "mst@...hat.com" <mst@...hat.com>, 
	"virtualization@...ts.linux-foundation.org" <virtualization@...ts.linux-foundation.org>, 
	"davem@...emloft.net" <davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>, 
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>, "kuba@...nel.org" <kuba@...nel.org>, 
	"xuanzhuo@...ux.alibaba.com" <xuanzhuo@...ux.alibaba.com>, "pabeni@...hat.com" <pabeni@...hat.com>
Subject: Re: [PATCH net] virtio-net: fix race between set queues and probe

On Tue, Aug 8, 2023 at 7:35 PM Dragos Tatulea <dtatulea@...dia.com> wrote:
>
> On Tue, 2023-07-25 at 03:20 -0400, Jason Wang wrote:
> > A race were found where set_channels could be called after registering
> > but before virtnet_set_queues() in virtnet_probe(). Fixing this by
> > moving the virtnet_set_queues() before netdevice registering. While at
> > it, use _virtnet_set_queues() to avoid holding rtnl as the device is
> > not even registered at that time.
> >
> > Fixes: a220871be66f ("virtio-net: correctly enable multiqueue")
> > Signed-off-by: Jason Wang <jasowang@...hat.com>
> > ---
> >  drivers/net/virtio_net.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 0db14f6b87d3..1270c8d23463 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -4219,6 +4219,8 @@ static int virtnet_probe(struct virtio_device *vdev)
> >         if (vi->has_rss || vi->has_rss_hash_report)
> >                 virtnet_init_default_rss(vi);
> >
> > +       _virtnet_set_queues(vi, vi->curr_queue_pairs);
> > +
> >         /* serialize netdev register + virtio_device_ready() with ndo_open()
> > */
> >         rtnl_lock();
> >
> > @@ -4257,8 +4259,6 @@ static int virtnet_probe(struct virtio_device *vdev)
> >                 goto free_unregister_netdev;
> >         }
> >
> > -       virtnet_set_queues(vi, vi->curr_queue_pairs);
> > -
> >         /* Assume link up if device can't report link status,
> >            otherwise get link status from config. */
> >         netif_carrier_off(dev);
>
> This change seems to break mlx5_vdpa when using virtio_vdpa.
> _virtnet_set_queues() hangs. Because DRIVER_OK has not yet been set, mlx5_vdpa
> cvq kick handler will ignore any commands.
>

Yes, I will post a fix soon.

Thanks


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ