[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] vdpa: harden the error path if get_iova_range failed
From: |
Jason Wang |
Subject: |
Re: [PATCH 2/2] vdpa: harden the error path if get_iova_range failed |
Date: |
Wed, 28 Dec 2022 14:47:35 +0800 |
On Sat, Dec 24, 2022 at 7:49 PM Longpeng(Mike) <longpeng2@huawei.com> wrote:
>
> From: Longpeng <longpeng2@huawei.com>
>
> We should stop if the GET_IOVA_RANGE ioctl failed.
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
>
> Signed-off-by: Longpeng <longpeng2@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 ffdc435d19..e65023d013 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -797,7 +797,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.23.0
>