DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@intel.com, stable@dpdk.org,
	Rasesh Mody <rmody@marvell.com>,
	Shahed Shaikh <shshaikh@marvell.com>
Subject: [dpdk-dev] [PATCH 2/3] net/bnx2x: fix invalid free on unplug
Date: Mon, 17 Jun 2019 17:05:23 +0200	[thread overview]
Message-ID: <1560783924-5355-3-git-send-email-david.marchand@redhat.com> (raw)
In-Reply-To: <1560783924-5355-1-git-send-email-david.marchand@redhat.com>

mac_addrs points to a field in dev_private.
We can't let ethdev free it.

Fixes: e16adf08e54d ("ethdev: free all common data when releasing port")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/bnx2x/bnx2x_ethdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 45c6c36..f47a73c 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -701,6 +701,13 @@ void bnx2x_periodic_stop(void *param)
 	return bnx2x_common_dev_init(eth_dev, 1);
 }
 
+static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)
+{
+	/* mac_addrs must not be freed alone because part of dev_private */
+	eth_dev->data->mac_addrs = NULL;
+	return 0;
+}
+
 static struct rte_pci_driver rte_bnx2x_pmd;
 static struct rte_pci_driver rte_bnx2xvf_pmd;
 
@@ -719,7 +726,7 @@ static int eth_bnx2x_pci_probe(struct rte_pci_driver *pci_drv,
 
 static int eth_bnx2x_pci_remove(struct rte_pci_device *pci_dev)
 {
-	return rte_eth_dev_pci_generic_remove(pci_dev, NULL);
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_bnx2x_dev_uninit);
 }
 
 static struct rte_pci_driver rte_bnx2x_pmd = {
-- 
1.8.3.1


  parent reply	other threads:[~2019-06-17 15:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 15:05 [dpdk-dev] [PATCH 0/3] ethdev mac_addrs cleanups David Marchand
2019-06-17 15:05 ` [dpdk-dev] [PATCH 1/3] net/nfb: avoid memory leak on unplug David Marchand
2019-06-26 17:21   ` Ferruh Yigit
2019-06-17 15:05 ` David Marchand [this message]
2019-06-26 17:21   ` [dpdk-dev] [PATCH 2/3] net/bnx2x: fix invalid free " Ferruh Yigit
2019-06-17 15:05 ` [dpdk-dev] [PATCH 3/3] drivers/net: fix double free on init failure cleanup David Marchand
2019-06-26 17:21   ` [dpdk-dev] [dpdk-stable] " 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=1560783924-5355-3-git-send-email-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=rmody@marvell.com \
    --cc=shshaikh@marvell.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).