ath11k: fix missing skb drop on htc_tx_completion error
authorChristian 'Ansuel' Marangi <ansuelsmth@gmail.com>
Sat, 28 May 2022 14:25:16 +0000 (16:25 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Mon, 6 Jun 2022 14:07:05 +0000 (17:07 +0300)
On htc_tx_completion error the skb is not dropped. This is wrong since
the completion_handler logic expect the skb to be consumed anyway even
when an error is triggered. Not freeing the skb on error is a memory
leak since the skb won't be freed anywere else. Correctly free the
packet on eid >= ATH11K_HTC_EP_COUNT before returning.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1

Fixes: f951380a6022 ("ath11k: Disabling credit flow for WMI path")
Signed-off-by: Christian 'Ansuel' Marangi <ansuelsmth@gmail.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220528142516.20819-2-ansuelsmth@gmail.com
drivers/net/wireless/ath/ath11k/htc.c

index 069c29a4fac70199da7f8a40638dde777fb9c2f3..ca3aedc0252d5ffc2993ced94f31da6f2944dd2c 100644 (file)
@@ -258,8 +258,10 @@ void ath11k_htc_tx_completion_handler(struct ath11k_base *ab,
        u8 eid;
 
        eid = ATH11K_SKB_CB(skb)->eid;
-       if (eid >= ATH11K_HTC_EP_COUNT)
+       if (eid >= ATH11K_HTC_EP_COUNT) {
+               dev_kfree_skb_any(skb);
                return;
+       }
 
        ep = &htc->endpoint[eid];
        spin_lock_bh(&htc->tx_lock);