Now virtio_device_ready() will return error if we get
invalid status. Let's handle this case on probe.
Signed-off-by: Xie Yongji <[email protected]>
---
net/9p/trans_virtio.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 0960ed1ad7ac..6013d3761b76 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -617,7 +617,9 @@ static int p9_virtio_probe(struct virtio_device *vdev)
/* Ceiling limit to avoid denial of service attacks */
chan->p9_max_pages = nr_free_buffer_pages()/4;
- virtio_device_ready(vdev);
+ err = virtio_device_ready(vdev);
+ if (err)
+ goto out_free_vc_wq;
mutex_lock(&virtio_9p_lock);
list_add_tail(&chan->chan_list, &virtio_chan_list);
@@ -628,6 +630,8 @@ static int p9_virtio_probe(struct virtio_device *vdev)
return 0;
+out_free_vc_wq:
+ kfree(chan->vc_wq);
out_remove_file:
sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
out_free_tag:
--
2.11.0
Xie Yongji wrote on Mon, May 17, 2021 at 05:34:28PM +0800:
> Now virtio_device_ready() will return error if we get
> invalid status. Let's handle this case on probe.
The change itself looks good to me
It's going to be a pain to apply though because it depends on
https://lkml.kernel.org/r/[email protected]
you just sent, so this won't apply to virtio maintainers on one hand,
and I can't take just this patch because it depends on the first patch
in the patchset (well if it weren't RFC)...
I guess sending the other patch to Linus fast-ish so it can go in virtio
tree would be the best way forward? other maintainers please advise, I'm
bad at this.
> Signed-off-by: Xie Yongji <[email protected]>
Acked-by: Dominique Martinet <[email protected]>
--
Dominique