From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D522E2BD1 for ; Tue, 24 Jan 2017 16:01:13 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP; 24 Jan 2017 07:01:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,278,1477983600"; d="scan'208";a="1117143161" Received: from rhorton-mobl.ger.corp.intel.com (HELO VM.ir.intel.com) ([163.33.230.192]) by fmsmga002.fm.intel.com with ESMTP; 24 Jan 2017 07:01:11 -0800 From: Remy Horton To: dev@dpdk.org, Thomas Monjalon Date: Tue, 24 Jan 2017 15:01:11 +0000 Message-Id: <1485270071-5407-1-git-send-email-remy.horton@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1484073764-15001-1-git-send-email-remy.horton@intel.com> Subject: [dpdk-dev] [PATCH v2] ethdev: fix multi-process NULL dereference crashes 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: , X-List-Received-Date: Tue, 24 Jan 2017 15:01:14 -0000 Secondary processes were blanket zeroing ethernet device memory, resulting in NULL dereference crashes in multi-process setups. Fixes: 7f95f78a8aea ("ethdev: clear data when allocating device") Signed-off-by: Remy Horton --- doc/guides/rel_notes/release_17_02.rst | 5 +++++ lib/librte_ether/rte_ethdev.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst index 0ecd720..1472f84 100644 --- a/doc/guides/rel_notes/release_17_02.rst +++ b/doc/guides/rel_notes/release_17_02.rst @@ -222,6 +222,11 @@ Drivers Fixed few regressions introduced in recent releases that break the virtio multiple process support. +* **ethdev: Fixed crash with multi-processing.** + + Secondary processes were blanket zeroing ethernet device memory, + resulting in NULL dereference crashes in multi-process setups. + Libraries ~~~~~~~~~ diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 61f44e2..d911921 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -225,8 +225,10 @@ rte_eth_dev_allocate(const char *name) return NULL; } - memset(&rte_eth_dev_data[port_id], 0, sizeof(struct rte_eth_dev_data)); eth_dev = eth_dev_get(port_id); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + memset(&rte_eth_dev_data[port_id], 0, + sizeof(struct rte_eth_dev_data)); snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name); eth_dev->data->port_id = port_id; eth_dev->data->mtu = ETHER_MTU; -- 2.5.5