]> git.ipfire.org Git - thirdparty/kernel/linux.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)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 30 May 2024 15:49:22 +0000 (18:49 +0300)
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
drivers/net/wireless/ath/ath12k/dp_rx.c

index a52b7b273540f4a90c56dd3cdbbcce09678849c5..cb1f308f096b1d77061fd99b61f90a7da106aa14 100644 (file)
@@ -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;
        }