wifi: ath10k: fix NULL pointer dereference in ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev()
authorXingyuan Mo <hdthky0@gmail.com>
Sun, 17 Dec 2023 11:29:01 +0000 (13:29 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Mon, 18 Dec 2023 18:41:00 +0000 (20:41 +0200)
We should check whether the WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT tlv is
present before accessing it, otherwise a null pointer deference error will
occur.

Fixes: dc405152bb64 ("ath10k: handle mgmt tx completion event")
Signed-off-by: Xingyuan Mo <hdthky0@gmail.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231208043433.271449-1-hdthky0@gmail.com
drivers/net/wireless/ath/ath10k/wmi-tlv.c

index 6b6aa3c36744876df49180fb9955b02cff9a446b..0ce08e9a0a3d2d92e6dc7409024df8e697369ad2 100644 (file)
@@ -851,6 +851,10 @@ ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev(struct ath10k *ar, struct sk_buff *skb,
        }
 
        ev = tb[WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT];
+       if (!ev) {
+               kfree(tb);
+               return -EPROTO;
+       }
 
        arg->desc_id = ev->desc_id;
        arg->status = ev->status;