[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517093428.670-16-xieyongji@bytedance.com>
Date: Mon, 17 May 2021 17:34:28 +0800
From: Xie Yongji <xieyongji@...edance.com>
To: mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com
Cc: amit@...nel.org, arei.gonglei@...wei.com, airlied@...ux.ie,
kraxel@...hat.com, jean-philippe@...aro.org, ohad@...ery.com,
bjorn.andersson@...aro.org, david@...hat.com, vgoyal@...hat.com,
miklos@...redi.hu, lucho@...kov.net, asmadeus@...ewreck.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 15/15] 9p/trans_virtio: Handle virtio_device_ready() failure
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>
---
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
Powered by blists - more mailing lists