[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CACGkMEtUf=23oxwe=QjhD9AhSRHPNuHfNKBJHPrAPLQk3oLFWA@mail.gmail.com>
Date: Mon, 30 Jan 2023 11:58:42 +0800
From: Jason Wang <jasowang@...hat.com>
To: Hillf Danton <hdanton@...a.com>
Cc: mst@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, eperezma@...hat.com
Subject: Re: [PATCH 3/4] virtio_ring: introduce a per virtqueue waitqueue
On Sun, Jan 29, 2023 at 3:37 PM Hillf Danton <hdanton@...a.com> wrote:
>
> On Mon, 26 Dec 2022 15:49:07 +0800 Jason Wang <jasowang@...hat.com>
> > @@ -2654,6 +2663,8 @@ static void vring_free(struct virtqueue *_vq)
> > {
> > struct vring_virtqueue *vq = to_vvq(_vq);
> >
> > + wake_up_interruptible(&vq->wq);
> > +
> > if (vq->we_own_ring) {
> > if (vq->packed_ring) {
> > vring_free_queue(vq->vq.vdev,
> > @@ -2863,4 +2874,22 @@ const struct vring *virtqueue_get_vring(struct virtqueue *vq)
> > }
> > EXPORT_SYMBOL_GPL(virtqueue_get_vring);
> >
> > +int virtqueue_wait_for_used(struct virtqueue *_vq)
> > +{
> > + struct vring_virtqueue *vq = to_vvq(_vq);
> > +
> > + /* TODO: Tweak the timeout. */
> > + return wait_event_interruptible_timeout(vq->wq,
> > + virtqueue_is_broken(_vq) || more_used(vq), HZ);
> > +}
> > +EXPORT_SYMBOL_GPL(virtqueue_wait_for_used);
>
> waker waiter
> --- ---
> vring_del_virtqueue
> vring_free(_vq);
> wakeup
> kfree(vq);
> get on CPU a tick later
> uaf ?
>
Exactly, this wakeup of vring_free is not needed. It's up to the
driver to do the proper wake up to avoid race when subsystem un
registration.
Thanks
Powered by blists - more mailing lists