[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACycT3us0h_mpiZ+aeBt18HDwDs3GQf=-tDjQAyqtYfHCVw8YQ@mail.gmail.com>
Date: Mon, 17 May 2021 18:08:12 +0800
From: Yongji Xie <xieyongji@...edance.com>
To: David Hildenbrand <david@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>, amit@...nel.org,
arei.gonglei@...wei.com, airlied@...ux.ie, kraxel@...hat.com,
jean-philippe@...aro.org, Ohad Ben Cohen <ohad@...ery.com>,
bjorn.andersson@...aro.org, vgoyal@...hat.com, miklos@...redi.hu,
lucho@...kov.net, asmadeus@...ewreck.org,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Re: [RFC PATCH 13/15] virtio-mem: Handle virtio_device_ready() failure
On Mon, May 17, 2021 at 5:48 PM David Hildenbrand <david@...hat.com> wrote:
>
> On 17.05.21 11:34, Xie Yongji wrote:
> > Now virtio_device_ready() will return error if we get
> > invalid status. Let's handle this case on probe.
> >
> > Signed-off-by: Xie Yongji <xieyongji@...edance.com>
> > ---
> > drivers/virtio/virtio_mem.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> > index 32a8e359a5c3..1148c392ff94 100644
> > --- a/drivers/virtio/virtio_mem.c
> > +++ b/drivers/virtio/virtio_mem.c
> > @@ -2602,13 +2602,17 @@ static int virtio_mem_probe(struct virtio_device *vdev)
> > if (rc)
> > goto out_unreg_mem;
> >
> > - virtio_device_ready(vdev);
> > + rc = virtio_device_ready(vdev);
> > + if (rc)
> > + goto out_unreg_device;
> >
> > /* trigger a config update to start processing the requested_size */
> > atomic_set(&vm->config_changed, 1);
> > queue_work(system_freezable_wq, &vm->wq);
> >
> > return 0;
> > +out_unreg_device:
> > + unregister_virtio_mem_device(vm);
> > out_unreg_mem:
> > unregister_memory_notifier(&vm->memory_notifier);
> > out_del_resource:
> >
>
> I assume this will really be a corner case to hit, right?
>
Yes, it should almost never happen if the device is trusted.
Thanks,
Yongji
Powered by blists - more mailing lists