All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com
Cc: Zhang Changzhong <zhangchangzhong@huawei.com>,
	netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
	Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>,
	Leon Romanovsky <leonro@nvidia.com>
Subject: [PATCH net v2 5/5] ice: switch: fix potential memleak in ice_add_adv_recipe()
Date: Mon,  6 Feb 2023 15:29:34 -0800	[thread overview]
Message-ID: <20230206232934.634298-6-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20230206232934.634298-1-anthony.l.nguyen@intel.com>

From: Zhang Changzhong <zhangchangzhong@huawei.com>

When ice_add_special_words() fails, the 'rm' is not released, which will
lead to a memory leak. Fix this up by going to 'err_unroll' label.

Compile tested only.

Fixes: 8b032a55c1bd ("ice: low level support for tunnels")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 9b762f7972ce..61f844d22512 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -5420,7 +5420,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 	 */
 	status = ice_add_special_words(rinfo, lkup_exts, ice_is_dvm_ena(hw));
 	if (status)
-		goto err_free_lkup_exts;
+		goto err_unroll;
 
 	/* Group match words into recipes using preferred recipe grouping
 	 * criteria.
-- 
2.38.1


  parent reply	other threads:[~2023-02-06 23:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 23:29 [PATCH net v2 0/5][pull request] Intel Wired LAN Driver Updates 2023-02-06 (ice) Tony Nguyen
2023-02-06 23:29 ` [PATCH net v2 1/5] ice: Do not use WQ_MEM_RECLAIM flag for workqueue Tony Nguyen
2023-02-06 23:29 ` [PATCH net v2 2/5] ice: fix out-of-bounds KASAN warning in virtchnl Tony Nguyen
2023-02-06 23:29 ` [PATCH net v2 3/5] ice: Fix disabling Rx VLAN filtering with port VLAN enabled Tony Nguyen
2023-02-06 23:29 ` [PATCH net v2 4/5] ice: Fix off by one in ice_tc_forward_to_queue() Tony Nguyen
2023-02-06 23:29 ` Tony Nguyen [this message]
2023-02-08  6:10 ` [PATCH net v2 0/5][pull request] Intel Wired LAN Driver Updates 2023-02-06 (ice) patchwork-bot+netdevbpf

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=20230206232934.634298-6-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sujai.buvaneswaran@intel.com \
    --cc=zhangchangzhong@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.