40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
|
|
From fe4dd977b4dec6a089992566bda4b29136ed62c9 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Longpeng <longpeng2@huawei.com>
|
||
|
|
Date: Sat, 24 Dec 2022 19:48:48 +0800
|
||
|
|
Subject: [PATCH] vdpa: harden the error path if get_iova_range failed
|
||
|
|
|
||
|
|
We should stop if the GET_IOVA_RANGE ioctl failed.
|
||
|
|
|
||
|
|
Signed-off-by: Longpeng <longpeng2@huawei.com>
|
||
|
|
Message-Id: <20221224114848.3062-3-longpeng2@huawei.com>
|
||
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||
|
|
Acked-by: Jason Wang <jasowang@redhat.com>
|
||
|
|
Signed-off-by: fangyi <eric.fangyi@huawei.com>
|
||
|
|
---
|
||
|
|
net/vhost-vdpa.c | 8 +++++++-
|
||
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
|
||
|
|
index 3c370f2dc5..fd5dc8c6aa 100644
|
||
|
|
--- a/net/vhost-vdpa.c
|
||
|
|
+++ b/net/vhost-vdpa.c
|
||
|
|
@@ -812,7 +812,13 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
|
||
|
|
return queue_pairs;
|
||
|
|
}
|
||
|
|
|
||
|
|
- vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
|
||
|
|
+ r = vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
|
||
|
|
+ if (unlikely(r < 0)) {
|
||
|
|
+ error_setg(errp, "vhost-vdpa: get iova range failed: %s",
|
||
|
|
+ strerror(-r));
|
||
|
|
+ goto err;
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
if (opts->x_svq) {
|
||
|
|
if (!vhost_vdpa_net_valid_svq_features(features, errp)) {
|
||
|
|
goto err_svq;
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|