Null value for parameters will cause segfault.
Fixes:
d7280c9fffcb ("vhost: support selective datapath")
Fixes:
72e8543093df ("vhost: add API to get MTU value")
Fixes:
a277c7159876 ("vhost: refactor code structure")
Fixes:
ca33faf9ef10 ("vhost: introduce API to fetch negotiated features")
Fixes:
eb32247457fe ("vhost: export guest memory regions")
Fixes:
40ef286f236a ("vhost: export vhost vring info")
Fixes:
bd2e0c3fe5ac ("vhost: add APIs for live migration")
Fixes:
0b8572a0c101 ("vhost: add external message handling to the API")
Fixes:
b4953225cea4 ("vhost: add APIs for datapath configuration")
Fixes:
5fbb3941da9f ("vhost: introduce driver features related APIs")
Fixes:
292959c71961 ("vhost: cleanup unix socket")
Cc: stable@dpdk.org
Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
+ if (path == NULL)
+ return NULL;
+
for (i = 0; i < vhost_user.vsocket_cnt; i++) {
struct vhost_user_socket *vsocket = vhost_user.vsockets[i];
for (i = 0; i < vhost_user.vsocket_cnt; i++) {
struct vhost_user_socket *vsocket = vhost_user.vsockets[i];
{
struct vhost_user_socket *vsocket;
{
struct vhost_user_socket *vsocket;
- if (rte_vdpa_get_device(did) == NULL)
+ if (rte_vdpa_get_device(did) == NULL || path == NULL)
return -1;
pthread_mutex_lock(&vhost_user.mutex);
return -1;
pthread_mutex_lock(&vhost_user.mutex);
int count;
struct vhost_user_connection *conn, *next;
int count;
struct vhost_user_connection *conn, *next;
+ if (path == NULL)
+ return -1;
+
again:
pthread_mutex_lock(&vhost_user.mutex);
again:
pthread_mutex_lock(&vhost_user.mutex);
char device_name[MAX_VDPA_NAME_LEN];
int i;
char device_name[MAX_VDPA_NAME_LEN];
int i;
- if (vdpa_device_num >= MAX_VHOST_DEVICE)
+ if (vdpa_device_num >= MAX_VHOST_DEVICE || addr == NULL || ops == NULL)
return -1;
for (i = 0; i < MAX_VHOST_DEVICE; i++) {
return -1;
for (i = 0; i < MAX_VHOST_DEVICE; i++) {
struct rte_vdpa_device *dev;
int i;
struct rte_vdpa_device *dev;
int i;
+ if (addr == NULL)
+ return -1;
+
for (i = 0; i < MAX_VHOST_DEVICE; ++i) {
dev = vdpa_devices[i];
if (dev && is_same_vdpa_device(&dev->addr, addr))
for (i = 0; i < MAX_VHOST_DEVICE; ++i) {
dev = vdpa_devices[i];
if (dev && is_same_vdpa_device(&dev->addr, addr))
{
struct virtio_net *dev = get_device(vid);
{
struct virtio_net *dev = get_device(vid);
+ if (dev == NULL || mtu == NULL)
return -ENODEV;
if (!(dev->flags & VIRTIO_DEV_READY))
return -ENODEV;
if (!(dev->flags & VIRTIO_DEV_READY))
{
struct virtio_net *dev = get_device(vid);
{
struct virtio_net *dev = get_device(vid);
+ if (dev == NULL || buf == NULL)
return -1;
len = RTE_MIN(len, sizeof(dev->ifname));
return -1;
len = RTE_MIN(len, sizeof(dev->ifname));
struct virtio_net *dev;
dev = get_device(vid);
struct virtio_net *dev;
dev = get_device(vid);
+ if (dev == NULL || features == NULL)
return -1;
*features = dev->features;
return -1;
*features = dev->features;
size_t size;
dev = get_device(vid);
size_t size;
dev = get_device(vid);
+ if (dev == NULL || mem == NULL)
return -1;
size = dev->mem->nregions * sizeof(struct rte_vhost_mem_region);
return -1;
size = dev->mem->nregions * sizeof(struct rte_vhost_mem_region);
struct vhost_virtqueue *vq;
dev = get_device(vid);
struct vhost_virtqueue *vq;
dev = get_device(vid);
+ if (dev == NULL || vring == NULL)
return -1;
if (vring_idx >= VHOST_MAX_VRING)
return -1;
if (vring_idx >= VHOST_MAX_VRING)
{
struct virtio_net *dev = get_device(vid);
{
struct virtio_net *dev = get_device(vid);
+ if (dev == NULL || log_base == NULL || log_size == NULL)
return -1;
*log_base = dev->log_base;
return -1;
*log_base = dev->log_base;
{
struct virtio_net *dev = get_device(vid);
{
struct virtio_net *dev = get_device(vid);
+ if (dev == NULL || last_avail_idx == NULL || last_used_idx == NULL)
return -1;
*last_avail_idx = dev->virtqueue[queue_id]->last_avail_idx;
return -1;
*last_avail_idx = dev->virtqueue[queue_id]->last_avail_idx;
{
struct virtio_net *dev = get_device(vid);
{
struct virtio_net *dev = get_device(vid);
+ if (dev == NULL || ops == NULL)
return -1;
dev->extern_ops = *ops;
return -1;
dev->extern_ops = *ops;