From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <qi.z.zhang@intel.com>, <xiao.w.wang@intel.com>,
<jerry.lilijun@huawei.com>, <xudingke@huawei.com>,
Yunjian Wang <wangyunjian@huawei.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/fm10k: fix memory leak when thresh check fails
Date: Mon, 28 Sep 2020 20:44:42 +0800 [thread overview]
Message-ID: <a2539f03a15953d1b8f0511a9851a7a00b756867.1601296012.git.wangyunjian@huawei.com> (raw)
From: Yunjian Wang <wangyunjian@huawei.com>
In fm10k_rx_queue_setup(), we allocate memory for the queue
structure but not released when thresh check fails.
Fixes: 6cfe8969c969 ("fm10k: add Rx queue setup/release")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
drivers/net/fm10k/fm10k_ethdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 5771d83b5..98e396b8e 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1841,9 +1841,10 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,
q->tail_ptr = (volatile uint32_t *)
&((uint32_t *)hw->hw_addr)[FM10K_RDT(queue_id)];
q->offloads = offloads;
- if (handle_rxconf(q, conf))
+ if (handle_rxconf(q, conf)) {
+ rte_free(q);
return -EINVAL;
-
+ }
/* allocate memory for the software ring */
q->sw_ring = rte_zmalloc_socket("fm10k sw ring",
(nb_desc + q->nb_fake_desc) * sizeof(struct rte_mbuf *),
--
2.23.0
next reply other threads:[~2020-09-28 12:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 12:44 wangyunjian [this message]
2020-09-28 13:32 ` Zhang, Qi Z
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=a2539f03a15953d1b8f0511a9851a7a00b756867.1601296012.git.wangyunjian@huawei.com \
--to=wangyunjian@huawei.com \
--cc=dev@dpdk.org \
--cc=jerry.lilijun@huawei.com \
--cc=qi.z.zhang@intel.com \
--cc=stable@dpdk.org \
--cc=xiao.w.wang@intel.com \
--cc=xudingke@huawei.com \
/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).