diff options
author | Longpeng <longpeng2@huawei.com> | 2022-12-24 19:48:48 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-01-08 01:54:22 -0500 |
commit | bf7a2ad8b6dfab4adb40db44022e4c424b56421e (patch) | |
tree | 8d33f4c160cf2a7bee7baacd1f07786806d9b5b7 /net | |
parent | c672f348cb20e40c8c4fd1dfbd3e60d8202e3eac (diff) | |
download | qemu-bf7a2ad8b6dfab4adb40db44022e4c424b56421e.zip qemu-bf7a2ad8b6dfab4adb40db44022e4c424b56421e.tar.gz qemu-bf7a2ad8b6dfab4adb40db44022e4c424b56421e.tar.bz2 |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/vhost-vdpa.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index b6e1e84..1a13a34 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -805,7 +805,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; |