From: Sunil Kumar Kori <skori@marvell.com>
To: Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>, Sunil Kumar Kori <skori@marvell.com>
Subject: [dpdk-dev] [PATCH] net/octeontx: fix memory leak of MAC address table
Date: Wed, 29 Jan 2020 14:47:04 +0530 [thread overview]
Message-ID: <20200129091704.18217-1-skori@marvell.com> (raw)
MAC address table is allocated during octeontx device create and
same is used to maintain list of MAC address associated to port.
This table is not getting freed niether in case of error nor during
graceful shutdown of port.
Patch fixes memory required memory for both the cases as mentioned.
Fixes: f18b146c498d ("net/octeontx: create ethdev ports")
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
drivers/net/octeontx/octeontx_ethdev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index e23162d8a..40d9d67da 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -351,6 +351,10 @@ octeontx_dev_close(struct rte_eth_dev *dev)
rte_free(txq);
}
+ /* Free MAC address table */
+ rte_free(dev->data->mac_addrs);
+ dev->data->mac_addrs = NULL;
+
dev->tx_pkt_burst = NULL;
dev->rx_pkt_burst = NULL;
}
@@ -1143,7 +1147,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
octeontx_log_err("eth_dev->port_id (%d) is diff to orig (%d)",
data->port_id, nic->port_id);
res = -EINVAL;
- goto err;
+ goto free_mac_addrs;
}
/* Update port_id mac to eth_dev */
@@ -1162,6 +1166,8 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
rte_eth_dev_probing_finish(eth_dev);
return data->port_id;
+free_mac_addrs:
+ rte_free(data->mac_addrs);
err:
if (nic)
octeontx_port_close(nic);
--
2.17.1
next reply other threads:[~2020-01-29 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 9:17 Sunil Kumar Kori [this message]
2020-01-29 12:28 ` Harman Kalra
2020-02-03 9:54 ` Jerin Jacob
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=20200129091704.18217-1-skori@marvell.com \
--to=skori@marvell.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--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).