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 8B187A0562; Tue, 31 Mar 2020 19:14:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3D72F1C0C4; Tue, 31 Mar 2020 19:14:33 +0200 (CEST) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id CA9981C0B9 for ; Tue, 31 Mar 2020 19:14:22 +0200 (CEST) Received: by mail-pj1-f67.google.com with SMTP id l36so1340257pjb.3 for ; Tue, 31 Mar 2020 10:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hYn5Rs8jjETAf+mUXRLE6HeDZ/uR71Zo8u620Nr4Efw=; b=lRSREjDo+s6KBs2JakrfgXgDp5m4s7b5+tV2z36bWCoEGA4oiyysktzsbhYZ/wZ3zk FzAGMuacVmS7TPL3p+6xE4lpd3utMMqhzFFa0pb3RXOc0Lp0KM9PVVseXacNpFvO4t0x 2Vl2d8wN74tAQ7S4YHGvxp3vLdQPwmwSqXRnw8LkgqLd799FZpXwZwIs2tLrohi1hBHW pq4qU33tgqtSaSeLdgnIjqI0LJbFsCZ041Ol4P8NRbESO3xZM9mcvUML3LD3IpUZWr/i fiDr/eNEMupm1i4LODQjJFJ8KL3cDGACml+kOkNZMsbxzSlHRsv2sDnImw0aUVaSwv/r 7V6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hYn5Rs8jjETAf+mUXRLE6HeDZ/uR71Zo8u620Nr4Efw=; b=nTgli/kcT8Ji42GFuh+1J5mUw3Mtw/PPZog+NlEofa3kMyuadoRgrkE0UXTP/n5aCd 9yhXDjRCcTmRFE5LmCQcyHZ1tLGXK+m7+yBuFvQoPWXf0acyccTZYZVObjDfr46ZbuIv 0aDG0MqBUUh7BQvByAlBrnX8VZIjEkKXslNjJFKW3iTjGwAE5LO7JPg+9NZU4mJi7Kr/ Ps6MkU9sb4oxT10bmjZQP6igRLoCl/9yS7R7KAjh/eZLqyYwgCfRmxv4hmtepVNBRiDp ImAP1saw/zSy6ig/TairpR55H+WgfqXiNe6mgCXFZ4GUDL1VQvdF91SxzK9mGCrMSvC2 9bhg== X-Gm-Message-State: ANhLgQ0auUZB7jZFORQqGd9nrnHelN1N5Dc1CNg4YcSMFuzDiGZR50JJ WVM7KsetpTDGQIRUA/600TSEDo3ODchTCw== X-Google-Smtp-Source: ADFU+vsoNIWA36dKaKwiie54VdyakT/Acy8Kwie4f70CnfsQQ8jvfoRhZATBu7neF/WpobTG9rpu0Q== X-Received: by 2002:a17:902:ec01:: with SMTP id l1mr18572808pld.151.1585674861445; Tue, 31 Mar 2020 10:14:21 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id i124sm12869764pfg.14.2020.03.31.10.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 10:14:20 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org Date: Tue, 31 Mar 2020 10:14:00 -0700 Message-Id: <20200331171404.23596-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200331171404.23596-1-stephen@networkplumber.org> References: <20200316235612.29854-1-stephen@networkplumber.org> <20200331171404.23596-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 4/8] net/netvsc: fix invalid rte_free on dev_close 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" The netvsc PMD was putting the mac address in private data but the core rte_ethdev doesn't allow that it. It has to be in rte_malloc'd memory or the a message will be printed on shutdown/close. EAL: Invalid memory Fixes: f8279f47dd89 ("net/netvsc: fix crash in secondary process") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/net/netvsc/hn_ethdev.c | 16 ++++++++++------ drivers/net/netvsc/hn_var.h | 2 -- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index ac6610838008..05f1a25a1abc 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -134,8 +134,6 @@ eth_dev_vmbus_allocate(struct rte_vmbus_device *dev, size_t private_data_size) static void eth_dev_vmbus_release(struct rte_eth_dev *eth_dev) { - /* mac_addrs must not be freed alone because part of dev_private */ - eth_dev->data->mac_addrs = NULL; /* free ether device */ rte_eth_dev_release_port(eth_dev); @@ -937,9 +935,6 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_burst = &hn_xmit_pkts; eth_dev->rx_pkt_burst = &hn_recv_pkts; - /* Since Hyper-V only supports one MAC address, just use local data */ - eth_dev->data->mac_addrs = &hv->mac_addr; - /* * for secondary processes, we don't initialize any further as primary * has already done this work. @@ -947,6 +942,15 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + /* Since Hyper-V only supports one MAC address */ + eth_dev->data->mac_addrs = rte_calloc("hv_mac", HN_MAX_MAC_ADDRS, + sizeof(struct rte_ether_addr), 0); + if (eth_dev->data->mac_addrs == NULL) { + PMD_INIT_LOG(ERR, + "Failed to allocate memory store MAC addresses"); + return -ENOMEM; + } + hv->vmbus = vmbus; hv->rxbuf_res = &vmbus->resource[HV_RECV_BUF_MAP]; hv->chim_res = &vmbus->resource[HV_SEND_BUF_MAP]; @@ -989,7 +993,7 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) if (err) goto failed; - err = hn_rndis_get_eaddr(hv, hv->mac_addr.addr_bytes); + err = hn_rndis_get_eaddr(hv, eth_dev->data->mac_addrs->addr_bytes); if (err) goto failed; diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index 822d737bd3cc..b4c61717379f 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -139,8 +139,6 @@ struct hn_data { uint8_t rss_key[40]; uint16_t rss_ind[128]; - struct rte_ether_addr mac_addr; - struct rte_eth_dev_owner owner; struct rte_intr_handle vf_intr; -- 2.20.1