From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com, wenzhuo.luo@intel.com
Cc: paul.m.stillwell.jr@intel.com, dev@dpdk.org,
Qi Zhang <qi.z.zhang@intel.com>,
stable@dpdk.org, Jeb Cramer <jeb.j.cramer@intel.com>
Subject: [dpdk-dev] [PATCH 2/6] net/ice/base: fix resource leak
Date: Tue, 23 Jul 2019 11:48:25 +0800 [thread overview]
Message-ID: <20190723034829.42530-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20190723034829.42530-1-qi.z.zhang@intel.com>
We don't free s_rule if ice_aq_sw_rules() returns a non-zero status. If
it returned a zero status, s_rule would be freed right after, so this
implies it should be freed within the scope of the function regardless.
Fixes: c7dd15931183 ("net/ice/base: add virtual switch code")
Cc: stable@dpdk.org
Signed-off-by: Jeb Cramer <jeb.j.cramer@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/ice/base/ice_switch.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 0b5b1f41d..b249a3036 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -2787,12 +2787,13 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id,
status = ice_aq_sw_rules(hw, s_rule,
ICE_SW_RULE_RX_TX_NO_HDR_SIZE, 1,
ice_aqc_opc_remove_sw_rules, NULL);
- if (status)
- goto exit;
/* Remove a book keeping from the list */
ice_free(hw, s_rule);
+ if (status)
+ goto exit;
+
LIST_DEL(&list_elem->list_entry);
ice_free(hw, list_elem);
}
--
2.13.6
next prev parent reply other threads:[~2019-07-23 3:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 3:48 [dpdk-dev] [PATCH 1/6] net/ice/base: fix inner TCP and UDP support for GRE Qi Zhang
2019-07-23 3:48 ` Qi Zhang [this message]
2019-07-23 3:48 ` [dpdk-dev] [PATCH 3/6] net/ice/base: fix ptype variable size Qi Zhang
2019-07-23 3:48 ` [dpdk-dev] [PATCH 4/6] net/ice/base: use macro instead of function name Qi Zhang
2019-07-23 3:48 ` [dpdk-dev] [PATCH 5/6] net/ice/base: cleanup hardware register macros Qi Zhang
2019-07-23 3:48 ` [dpdk-dev] [PATCH 6/6] net/ice/base: fix for and/or bitmap routines Qi Zhang
2019-07-23 3:51 [dpdk-dev] [PATCH 0/6] net/ice/base: couple share code fix Qi Zhang
2019-07-23 3:51 ` [dpdk-dev] [PATCH 2/6] net/ice/base: fix resource leak Qi Zhang
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=20190723034829.42530-2-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=jeb.j.cramer@intel.com \
--cc=paul.m.stillwell.jr@intel.com \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
--cc=wenzhuo.luo@intel.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).