From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v4 4/8] net/netvsc: fix invalid rte_free on dev_close
Date: Tue, 31 Mar 2020 10:14:00 -0700 [thread overview]
Message-ID: <20200331171404.23596-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20200331171404.23596-1-stephen@networkplumber.org>
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 <stephen@networkplumber.org>
---
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
next prev parent reply other threads:[~2020-03-31 17:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 23:56 [dpdk-dev] [PATCH 0/2] net/netvsc: patches Stephen Hemminger
2020-03-16 23:56 ` [dpdk-dev] [PATCH 1/2] net/netvsc: handle receive packets during multi-channel setup Stephen Hemminger
2020-03-16 23:56 ` [dpdk-dev] [PATCH 2/2] net/netvsc: avoid mixing buffered and direct packets Stephen Hemminger
2020-03-18 17:33 ` [dpdk-dev] [PATCH 0/2] net/netvsc: patches Ferruh Yigit
2020-03-18 18:09 ` Stephen Hemminger
2020-03-19 9:06 ` Ferruh Yigit
2020-03-18 20:29 ` [dpdk-dev] [PATCH v2 0/4] net/netvsc patches Stephen Hemminger
2020-03-18 20:29 ` [dpdk-dev] [PATCH v2 1/4] net/netvsc: propogate descriptor limits from VF to netvsc Stephen Hemminger
2020-03-18 20:29 ` [dpdk-dev] [PATCH v2 2/4] net/netvsc: handle receive packets during multi-channel setup Stephen Hemminger
2020-03-18 20:29 ` [dpdk-dev] [PATCH v2 3/4] net/netvsc: split send buffers from transmit descriptors Stephen Hemminger
2020-03-18 20:29 ` [dpdk-dev] [PATCH v2 4/4] net/netvsc: don't enable RSS if only single receive queue Stephen Hemminger
2020-03-18 20:51 ` [dpdk-dev] [PATCH v3 0/4] net/netvsc patches Stephen Hemminger
2020-03-18 20:51 ` [dpdk-dev] [PATCH v3 1/4] net/netvsc: propagate descriptor limits from VF to netvsc Stephen Hemminger
2020-03-18 20:51 ` [dpdk-dev] [PATCH v3 2/4] net/netvsc: handle receive packets during multi-channel setup Stephen Hemminger
2020-03-18 20:51 ` [dpdk-dev] [PATCH v3 3/4] net/netvsc: split send buffers from transmit descriptors Stephen Hemminger
2020-03-18 20:51 ` [dpdk-dev] [PATCH v3 4/4] net/netvsc: don't enable RSS if only single receive queue Stephen Hemminger
2020-03-31 17:13 ` [dpdk-dev] [PATCH v4 0/8] net/netvsc: bug fixes Stephen Hemminger
2020-03-31 17:13 ` [dpdk-dev] [PATCH v4 1/8] net/netvsc: propagate descriptor limits from VF to netvsc Stephen Hemminger
2020-03-31 17:13 ` [dpdk-dev] [PATCH v4 2/8] net/netvsc: handle receive packets during multi-channel setup Stephen Hemminger
2020-03-31 17:13 ` [dpdk-dev] [PATCH v4 3/8] net/netvsc: split send buffers from transmit descriptors Stephen Hemminger
2020-03-31 17:14 ` Stephen Hemminger [this message]
2020-04-06 16:00 ` [dpdk-dev] [dpdk-stable] [PATCH v4 4/8] net/netvsc: fix invalid rte_free on dev_close Ferruh Yigit
2020-03-31 17:14 ` [dpdk-dev] [PATCH v4 5/8] net/netvsc: remove process event optimization Stephen Hemminger
2020-03-31 17:14 ` [dpdk-dev] [PATCH v4 6/8] net/netvsc: handle transmit completions based on burst size Stephen Hemminger
2020-03-31 17:14 ` [dpdk-dev] [PATCH v4 7/8] bus/vmbus: simplify args to need_signal Stephen Hemminger
2020-03-31 17:14 ` [dpdk-dev] [PATCH v4 8/8] net/netvsc: avoid possible live lock Stephen Hemminger
2020-04-07 8:34 ` [dpdk-dev] [PATCH v4 0/8] net/netvsc: bug fixes Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200331171404.23596-5-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).