Skip to content

Commit

Permalink
net/vhost: check creation failure
Browse files Browse the repository at this point in the history
[ upstream commit f04513b ]

The function eth_dev_vhost_create() could return errors,
the return value need to be checked.

Fixes: ee584e9 ("vhost: add driver on top of the library")

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
  • Loading branch information
wyjwang authored and kevintraynor committed Feb 7, 2020
1 parent ad2076e commit 59e1f98
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/vhost/rte_eth_vhost.c
Expand Up @@ -1286,7 +1286,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
}

rte_eth_dev_probing_finish(eth_dev);
return data->port_id;
return 0;

error:
if (internal) {
Expand Down Expand Up @@ -1424,8 +1424,10 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
if (dev->device.numa_node == SOCKET_ID_ANY)
dev->device.numa_node = rte_socket_id();

eth_dev_vhost_create(dev, iface_name, queues, dev->device.numa_node,
flags);
ret = eth_dev_vhost_create(dev, iface_name, queues,
dev->device.numa_node, flags);
if (ret == -1)
VHOST_LOG(ERR, "Failed to create %s\n", name);

out_free:
rte_kvargs_free(kvlist);
Expand Down

0 comments on commit 59e1f98

Please sign in to comment.