Skip to contentSkip to conversation

net: ath10k: santity check for ep connectivity

PATCH In review Zekun Shen 2 participants 4 messages Jun 22, 2020 – Jan 18, 2021

Subsystems (3)
lore
Share & tools
lore

Zekun Shen

author
#0 lore raw

PATCH 1/1 net: ath10k: santity check for ep connectivity

Function ep_rx_complete is being called without NULL checking in ath10k_htc_rx_completion_handler. Without such check, mal- formed packet is able to cause jump to NULL.

ep->service_id seems a good candidate for sanity check as it is used in usb.c.

---
 drivers/net/wireless/ath/ath10k/htc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath10k/htc.c +5 -0
index 31df6dd04..e00794d97 100644
@@ -450,6 +450,11 @@ void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb)
 
 	ep = &htc->endpoint[eid];
 
+	if (ep->service_id == 0) {
+		ath10k_warn(ar, "HTC Rx: ep %d is not connect\n", eid);
+		goto out;
+	}
+
 	payload_len = __le16_to_cpu(hdr->len);
 
 	if (payload_len + sizeof(*hdr) > ATH10K_HTC_MAX_LEN) {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 17 lines · Zekun Shen

Function ep_rx_complete is being called without NULL checking in ath10k_htc_rx_completion_handler. Without such check, mal- formed packet is able to cause jump to NULL.

ep->service_id seems a good candidate for sanity check as it is used in usb.c.

---
 drivers/net/wireless/ath/ath10k/htc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath10k/htc.c +0 -0
index 31df6dd04..e00794d97 100644

drivers/net/wireless/ath/ath10k/htc.c void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb) · line 456

Quoted 7 lines
drivers/net/wireless/ath/ath10k/htc.c +4 -0
@@ -450,6 +450,11 @@ void ath10k_htc_rx_completion_handler(struct ath10k *ar, struct sk_buff *skb)
 
 	ep = &htc->endpoint[eid];
 
+	if (ep->service_id == 0) {
+		ath10k_warn(ar, "HTC Rx: ep %d is not connect\n", eid);
+		goto out;
+	}

I think using ATH10K_HTC_SVC_ID_UNUSED is more descriptive than zero, as ath10k_htc_reset_endpoint_states() uses it. I fixed in the pending branch.

I think also ath10k_htc_process_credit_report() might have a similar problem, can you take a look?

Signature · 8 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#2 lore raw
In reply to Zekun Shen
Quoted 9 lines · Zekun Shen

Function ep_rx_complete is being called without NULL checking in ath10k_htc_rx_completion_handler. Without such check, mal- formed packet is able to cause jump to NULL.

ep->service_id seems a good candidate for sanity check as it is used in usb.c.

Patch applied to ath-next branch of ath.git, thanks.

d18ba9f1351c ath10k: sanitity check for ep connectivity

Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#3 lore raw
In reply to Zekun Shen
Quoted 9 lines · Zekun Shen

Function ep_rx_complete is being called without NULL checking in ath10k_htc_rx_completion_handler. Without such check, mal- formed packet is able to cause jump to NULL.

ep->service_id seems a good candidate for sanity check as it is used in usb.c.

Patch applied to ath-next branch of ath.git, thanks.

d18ba9f1351c ath10k: sanitity check for ep connectivity

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches