From: Chaoyong He <chaoyong.he@corigine.com>
To: stable@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 22.11 6/7] net/nfp: fix device resource freeing
Date: Thu, 7 Mar 2024 13:56:38 +0800 [thread overview]
Message-ID: <20240307055639.1626192-7-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240307055639.1626192-1-chaoyong.he@corigine.com>
[ upstream commit 09309f87358b3a538af47e31340898a15bb34d85 ]
Set the representor array to NULL to avoid that close interface
does not free some resource.
Representor array points to dev_private which is already freed by
'rte_eth_dev_release_port()', and 'nfp_flower_repr_dev_close()' requires
pointers to be NULL to proceed freeing other resources.
Fixes: 7c596721ae5f ("net/nfp: fix resource leak for flower firmware")
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
---
drivers/net/nfp/flower/nfp_flower_representor.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 61638c8..ac35a50 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -527,17 +527,30 @@ nfp_flower_repr_tx_burst(void *tx_queue,
static int
nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev)
{
+ uint16_t index;
struct nfp_flower_representor *repr;
repr = eth_dev->data->dev_private;
rte_ring_free(repr->ring);
+ if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id);
+ repr->app_fw_flower->phy_reprs[index] = NULL;
+ } else {
+ index = repr->vf_id;
+ repr->app_fw_flower->vf_reprs[index] = NULL;
+ }
+
return 0;
}
static int
-nfp_flower_pf_repr_uninit(__rte_unused struct rte_eth_dev *eth_dev)
+nfp_flower_pf_repr_uninit(struct rte_eth_dev *eth_dev)
{
+ struct nfp_flower_representor *repr = eth_dev->data->dev_private;
+
+ repr->app_fw_flower->pf_repr = NULL;
+
return 0;
}
--
2.39.1
next prev parent reply other threads:[~2024-03-07 5:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 5:56 [PATCH 22.11 0/7] backport patch series from NFP PMD Chaoyong He
2024-03-07 5:56 ` [PATCH 22.11 1/7] net/nfp: fix resource leak for CoreNIC firmware Chaoyong He
2024-03-07 5:56 ` [PATCH 22.11 2/7] net/nfp: fix resource leak for flower firmware Chaoyong He
2024-03-07 9:35 ` Luca Boccassi
2024-03-07 11:00 ` Chaoyong He
2024-03-07 11:03 ` Chaoyong He
2024-03-07 5:56 ` [PATCH 22.11 3/7] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2024-03-07 5:56 ` [PATCH 22.11 4/7] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2024-03-07 5:56 ` [PATCH 22.11 5/7] net/nfp: fix device close Chaoyong He
2024-03-07 5:56 ` Chaoyong He [this message]
2024-03-07 5:56 ` [PATCH 22.11 7/7] net/nfp: free switch domain ID on close Chaoyong He
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=20240307055639.1626192-7-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=oss-drivers@corigine.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).