diff mbox series

wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup()

Message ID 20240526124226.24661-1-quic_bqiang@quicinc.com (mailing list archive)
State Accepted
Commit 3d60041543189438cd1b03a1fa40ff6681c77970
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup() | expand

Commit Message

Baochen Qiang May 26, 2024, 12:42 p.m. UTC
Currently the resource allocated by crypto_alloc_shash() is not
freed in case ath12k_peer_find() fails, resulting in memory leak.

Add crypto_free_shash() to fix it.

This is found during code review, compile tested only.

Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/dp_rx.c | 1 +
 1 file changed, 1 insertion(+)


base-commit: f8320064a28242448eeb9fece08abd865ea8a226

Comments

Jeff Johnson May 28, 2024, 4:12 p.m. UTC | #1
On 5/26/2024 5:42 AM, Baochen Qiang wrote:
> Currently the resource allocated by crypto_alloc_shash() is not
> freed in case ath12k_peer_find() fails, resulting in memory leak.
> 
> Add crypto_free_shash() to fix it.
> 
> This is found during code review, compile tested only.
> 
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Kalle Valo May 30, 2024, 3:49 p.m. UTC | #2
Baochen Qiang <quic_bqiang@quicinc.com> wrote:

> Currently the resource allocated by crypto_alloc_shash() is not
> freed in case ath12k_peer_find() fails, resulting in memory leak.
> 
> Add crypto_free_shash() to fix it.
> 
> This is found during code review, compile tested only.
> 
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

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

3d6004154318 wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index a52b7b273540..cb1f308f096b 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -2742,6 +2742,7 @@  int ath12k_dp_rx_peer_frag_setup(struct ath12k *ar, const u8 *peer_mac, int vdev
 	peer = ath12k_peer_find(ab, vdev_id, peer_mac);
 	if (!peer) {
 		spin_unlock_bh(&ab->base_lock);
+		crypto_free_shash(tfm);
 		ath12k_warn(ab, "failed to find the peer to set up fragment info\n");
 		return -ENOENT;
 	}