All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe()
@ 2022-12-05  7:38 Zhang Changzhong
  2022-12-05  8:20 ` Leon Romanovsky
  2022-12-06 13:27 ` Jiri Pirko
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Changzhong @ 2022-12-05  7:38 UTC (permalink / raw)
  To: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michal Swiatkowski
  Cc: Zhang Changzhong, netdev, linux-kernel

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>
---
 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 9b762f7..61f844d 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.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe()
  2022-12-05  7:38 [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe() Zhang Changzhong
@ 2022-12-05  8:20 ` Leon Romanovsky
  2022-12-06 13:27 ` Jiri Pirko
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-12-05  8:20 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michal Swiatkowski, netdev,
	linux-kernel

On Mon, Dec 05, 2022 at 03:38:22PM +0800, Zhang Changzhong wrote:
> 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>
> ---
>  drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe()
  2022-12-05  7:38 [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe() Zhang Changzhong
  2022-12-05  8:20 ` Leon Romanovsky
@ 2022-12-06 13:27 ` Jiri Pirko
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2022-12-06 13:27 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: Jesse Brandeburg, Tony Nguyen, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michal Swiatkowski, netdev,
	linux-kernel

Mon, Dec 05, 2022 at 08:38:22AM CET, zhangchangzhong@huawei.com wrote:
>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>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-06 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05  7:38 [PATCH net] ice: switch: fix potential memleak in ice_add_adv_recipe() Zhang Changzhong
2022-12-05  8:20 ` Leon Romanovsky
2022-12-06 13:27 ` Jiri Pirko

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.