From: Baochen Qiang Date: Sun, 26 May 2024 12:42:26 +0000 (+0800) Subject: wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup() X-Git-Tag: v6.10.5~197 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc70ac360855df6a435fdbde6289f9b57e42fd30;p=thirdparty%2Fkernel%2Fstable.git wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup() [ Upstream commit 3d60041543189438cd1b03a1fa40ff6681c77970 ] 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 Acked-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://msgid.link/20240526124226.24661-1-quic_bqiang@quicinc.com Signed-off-by: Sasha Levin --- diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c index 121f27284be59..1d287ed25a949 100644 --- a/drivers/net/wireless/ath/ath12k/dp_rx.c +++ b/drivers/net/wireless/ath/ath12k/dp_rx.c @@ -2793,6 +2793,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; }