From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D1CACA0540; Tue, 14 Jul 2020 08:02:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 517171D551; Tue, 14 Jul 2020 08:02:03 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 5F1AB1D546 for ; Tue, 14 Jul 2020 08:02:01 +0200 (CEST) IronPort-SDR: rPBYkZk660fghpczinGllCPY6rEPW242iCtc+tdRCAmbpP7pT2AF2o7pXu0rKqUgS2wnWqhhHD Khluhd8wegdA== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="136280954" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="136280954" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 23:02:00 -0700 IronPort-SDR: PTO/mgiCpSJlzOQ4HFAXBzW8LIfTzAy5sK1Dxf1D2xCvu2z7hn6cur1N4J4RSQ+nAOjOvjpqwc U0tXJXLRenPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="459565485" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by orsmga005.jf.intel.com with ESMTP; 13 Jul 2020 23:01:58 -0700 From: patrick.fu@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: Patrick Fu Date: Tue, 14 Jul 2020 14:00:08 +0800 Message-Id: <20200714060008.1991779-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 Subject: [dpdk-dev] [PATCH v1] vhost: fix missing null dev pointer check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Patrick Fu 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: cd6760da10 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu --- lib/librte_vhost/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..235c31e28 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", -- 2.18.4