ath10k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ath10k: santity check for ep connectivity
@ 2020-06-22  2:20 Zekun Shen
  2020-12-21 18:15 ` Kalle Valo
  2021-01-18 16:12 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Zekun Shen @ 2020-06-22  2:20 UTC (permalink / raw)
  Cc: netdev, linux-wireless, linux-kernel, ath10k, Zekun Shen,
	Jakub Kicinski, David S. Miller, Kalle Valo

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.

Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
---
 drivers/net/wireless/ath/ath10k/htc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 31df6dd04..e00794d97 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -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) {
-- 
2.17.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ath10k: santity check for ep connectivity
  2020-06-22  2:20 [PATCH] net: ath10k: santity check for ep connectivity Zekun Shen
@ 2020-12-21 18:15 ` Kalle Valo
  2021-01-18 16:12 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-12-21 18:15 UTC (permalink / raw)
  To: Zekun Shen
  Cc: netdev, linux-wireless, linux-kernel, ath10k, Jakub Kicinski,
	David S. Miller

Zekun Shen <bruceshenzk@gmail.com> writes:

> 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.
>
> Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
> ---
>  drivers/net/wireless/ath/ath10k/htc.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
> index 31df6dd04..e00794d97 100644
> --- a/drivers/net/wireless/ath/ath10k/htc.c
> +++ b/drivers/net/wireless/ath/ath10k/htc.c
> @@ -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?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ath10k: santity check for ep connectivity
  2020-06-22  2:20 [PATCH] net: ath10k: santity check for ep connectivity Zekun Shen
  2020-12-21 18:15 ` Kalle Valo
@ 2021-01-18 16:12 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-01-18 16:12 UTC (permalink / raw)
  To: Zekun Shen
  Cc: , netdev, linux-wireless, linux-kernel, ath10k, Zekun Shen,
	Jakub Kicinski, David S. Miller

Zekun Shen <bruceshenzk@gmail.com> wrote:

> 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.
> 
> Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

d18ba9f1351c ath10k: sanitity check for ep connectivity

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20200622022055.16028-1-bruceshenzk@gmail.com/

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


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-18 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22  2:20 [PATCH] net: ath10k: santity check for ep connectivity Zekun Shen
2020-12-21 18:15 ` Kalle Valo
2021-01-18 16:12 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).