From: Patrick Fu Date: Tue, 21 Jul 2020 03:23:04 +0000 (+0800) Subject: vhost: fix missing device pointer validity check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6a82bceb563f1be130f3af70cb8ffac261cb8033;p=dpdk.git vhost: fix missing device pointer validity check This patch adds the check of dev pointer in vhost async enqueue completion poll. If a NULL dev pointer detected, the poll function returns immediately. Coverity issue: 360839 Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd44..235c31e288 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, uint16_t start_idx, pkts_idx, vq_size; uint64_t *async_pending_info; + if (!dev) + return 0; + VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__); if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) { VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n",