linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup
@ 2023-01-02  8:11 Miaoqian Lin
  2023-01-03  9:21 ` Leon Romanovsky
  2023-01-18  6:35 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2023-01-02  8:11 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Manikanta Pubbisetty, ath11k, linux-wireless,
	netdev, linux-kernel
  Cc: linmq006

crypto_alloc_shash() allocates resources, which should be released by
crypto_free_shash(). When ath11k_peer_find() fails, there has memory
leak. Add missing crypto_free_shash() to fix this.

Fixes: 243874c64c81 ("ath11k: handle RX fragments")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
change in v2:
- add crypto_free_shash() in the error path instead of move
crypto_alloc_shash().
---
 drivers/net/wireless/ath/ath11k/dp_rx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index c5a4c34d7749..0c53d88293eb 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -3126,6 +3126,7 @@ int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id
 	if (!peer) {
 		ath11k_warn(ab, "failed to find the peer to set up fragment info\n");
 		spin_unlock_bh(&ab->base_lock);
+		crypto_free_shash(tfm);
 		return -ENOENT;
 	}
 
-- 
2.25.1


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

* Re: [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup
  2023-01-02  8:11 [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup Miaoqian Lin
@ 2023-01-03  9:21 ` Leon Romanovsky
  2023-01-18  6:35 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-01-03  9:21 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Manikanta Pubbisetty, ath11k, linux-wireless,
	netdev, linux-kernel

On Mon, Jan 02, 2023 at 12:11:42PM +0400, Miaoqian Lin wrote:
> crypto_alloc_shash() allocates resources, which should be released by
> crypto_free_shash(). When ath11k_peer_find() fails, there has memory
> leak. Add missing crypto_free_shash() to fix this.
> 
> Fixes: 243874c64c81 ("ath11k: handle RX fragments")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> change in v2:
> - add crypto_free_shash() in the error path instead of move
> crypto_alloc_shash().
> ---
>  drivers/net/wireless/ath/ath11k/dp_rx.c | 1 +
>  1 file changed, 1 insertion(+)
> 

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

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

* Re: [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup
  2023-01-02  8:11 [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup Miaoqian Lin
  2023-01-03  9:21 ` Leon Romanovsky
@ 2023-01-18  6:35 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-01-18  6:35 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Manikanta Pubbisetty, ath11k, linux-wireless, netdev,
	linux-kernel, linmq006

Miaoqian Lin <linmq006@gmail.com> wrote:

> crypto_alloc_shash() allocates resources, which should be released by
> crypto_free_shash(). When ath11k_peer_find() fails, there has memory
> leak. Add missing crypto_free_shash() to fix this.
> 
> Fixes: 243874c64c81 ("ath11k: handle RX fragments")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

ed3f83b3459a wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230102081142.3937570-1-linmq006@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2023-01-18  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02  8:11 [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup Miaoqian Lin
2023-01-03  9:21 ` Leon Romanovsky
2023-01-18  6:35 ` Kalle Valo

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).