]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: ath12k: fix memory leak in ath12k_dp_rx_peer_frag_setup()
authorBaochen Qiang <quic_bqiang@quicinc.com>
Sun, 26 May 2024 12:42:26 +0000 (20:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2024 13:34:09 +0000 (15:34 +0200)
[ 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 <quic_bqiang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240526124226.24661-1-quic_bqiang@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath12k/dp_rx.c

index 121f27284be59c7a6d8e4e4835b5c3d177693a58..1d287ed25a9495e4bc2b0833448f042d084f01d0 100644 (file)
@@ -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;
        }