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 BE199A0526; Tue, 21 Jul 2020 05:25:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7185A1BFD4; Tue, 21 Jul 2020 05:25:17 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 6F5C11BFBA for ; Tue, 21 Jul 2020 05:25:16 +0200 (CEST) IronPort-SDR: bInZWIcc46vyikczn4LuoXighuwhE/H2sbNwo2BUk5/8C3Et6Ixd4yBlpcoWi2d4EVijFqljUk 06Lw3KVUukfw== X-IronPort-AV: E=McAfee;i="6000,8403,9688"; a="137542778" X-IronPort-AV: E=Sophos;i="5.75,377,1589266800"; d="scan'208";a="137542778" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2020 20:25:15 -0700 IronPort-SDR: sxGUhC2uFMNoIks6K0Jd3n4LDGJI4TPVeOOtHZUXBNJeAydFUKpk9m1WmyEOlDHKgUYaZ/Gcoq JSA+d0zYNsEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,377,1589266800"; d="scan'208";a="487934770" Received: from npg-dpdk-patrickfu-casc2.sh.intel.com ([10.67.119.92]) by fmsmga005.fm.intel.com with ESMTP; 20 Jul 2020 20:25:12 -0700 From: patrick.fu@intel.com To: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: Patrick Fu Date: Tue, 21 Jul 2020 11:23:04 +0800 Message-Id: <20200721032304.3372145-1-patrick.fu@intel.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20200714060008.1991779-1-patrick.fu@intel.com> References: <20200714060008.1991779-1-patrick.fu@intel.com> Subject: [dpdk-dev] [PATCH v3] vhost: fix missing device pointer validity 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: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu --- v2: - change fixline number v3: - revise commit message title 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