* [PATCH] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
@ 2023-05-13 21:41 Fedor Pchelkin
2023-05-15 12:15 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 5+ messages in thread
From: Fedor Pchelkin @ 2023-05-13 21:41 UTC (permalink / raw)
To: Kalle Valo
Cc: Fedor Pchelkin, Toke Høiland-Jørgensen,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-wireless, netdev, linux-kernel, Takeshi Misawa,
Alexey Khoroshilov, lvc-project, syzbot+b68fbebe56d8362907e8
A bad USB device is able to construct a service connection response
message with target endpoint being ENDPOINT0 which is reserved for
HTC_CTRL_RSVD_SVC and should not be modified to be used for any other
services.
Reject such service connection responses.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
Reported-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
drivers/net/wireless/ath/ath9k/htc_hst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index fe62ff668f75..a15d8d80df87 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -114,7 +114,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) {
epid = svc_rspmsg->endpoint_id;
- if (epid < 0 || epid >= ENDPOINT_MAX)
+ if (epid <= 0 || epid >= ENDPOINT_MAX)
return;
service_id = be16_to_cpu(svc_rspmsg->service_id);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
2023-05-13 21:41 [PATCH] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes Fedor Pchelkin
@ 2023-05-15 12:15 ` Toke Høiland-Jørgensen
2023-05-16 15:04 ` [PATCH v2] " Fedor Pchelkin
0 siblings, 1 reply; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-05-15 12:15 UTC (permalink / raw)
To: Fedor Pchelkin, Kalle Valo
Cc: Fedor Pchelkin, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-wireless, netdev, linux-kernel,
Takeshi Misawa, Alexey Khoroshilov, lvc-project,
syzbot+b68fbebe56d8362907e8
Fedor Pchelkin <pchelkin@ispras.ru> writes:
> A bad USB device is able to construct a service connection response
> message with target endpoint being ENDPOINT0 which is reserved for
> HTC_CTRL_RSVD_SVC and should not be modified to be used for any other
> services.
>
> Reject such service connection responses.
>
> Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
>
> Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
> Reported-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> ---
> drivers/net/wireless/ath/ath9k/htc_hst.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
> index fe62ff668f75..a15d8d80df87 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_hst.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
> @@ -114,7 +114,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
>
> if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) {
> epid = svc_rspmsg->endpoint_id;
> - if (epid < 0 || epid >= ENDPOINT_MAX)
> + if (epid <= 0 || epid >= ENDPOINT_MAX)
> return;
Hmm, I think we should use the ENDPOINT0 constant here, then, and maybe
add a comment above explaining that it's reserved?
-Toke
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
2023-05-15 12:15 ` Toke Høiland-Jørgensen
@ 2023-05-16 15:04 ` Fedor Pchelkin
2023-05-16 19:47 ` Toke Høiland-Jørgensen
2023-05-25 17:04 ` Kalle Valo
0 siblings, 2 replies; 5+ messages in thread
From: Fedor Pchelkin @ 2023-05-16 15:04 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Fedor Pchelkin, Kalle Valo, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-wireless, netdev,
linux-kernel, Takeshi Misawa, Alexey Khoroshilov, lvc-project,
syzbot+b68fbebe56d8362907e8
A bad USB device is able to construct a service connection response
message with target endpoint being ENDPOINT0 which is reserved for
HTC_CTRL_RSVD_SVC and should not be modified to be used for any other
services.
Reject such service connection responses.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
Reported-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
v2: per Toke's remark, use ENDPOINT0 macro and give a comment explaining
why it should be checked.
drivers/net/wireless/ath/ath9k/htc_hst.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index fe62ff668f75..99667aba289d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -114,7 +114,13 @@ static void htc_process_conn_rsp(struct htc_target *target,
if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) {
epid = svc_rspmsg->endpoint_id;
- if (epid < 0 || epid >= ENDPOINT_MAX)
+
+ /* Check that the received epid for the endpoint to attach
+ * a new service is valid. ENDPOINT0 can't be used here as it
+ * is already reserved for HTC_CTRL_RSVD_SVC service and thus
+ * should not be modified.
+ */
+ if (epid <= ENDPOINT0 || epid >= ENDPOINT_MAX)
return;
service_id = be16_to_cpu(svc_rspmsg->service_id);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
2023-05-16 15:04 ` [PATCH v2] " Fedor Pchelkin
@ 2023-05-16 19:47 ` Toke Høiland-Jørgensen
2023-05-25 17:04 ` Kalle Valo
1 sibling, 0 replies; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-05-16 19:47 UTC (permalink / raw)
To: Fedor Pchelkin
Cc: Fedor Pchelkin, Kalle Valo, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-wireless, netdev,
linux-kernel, Takeshi Misawa, Alexey Khoroshilov, lvc-project,
syzbot+b68fbebe56d8362907e8
Fedor Pchelkin <pchelkin@ispras.ru> writes:
> A bad USB device is able to construct a service connection response
> message with target endpoint being ENDPOINT0 which is reserved for
> HTC_CTRL_RSVD_SVC and should not be modified to be used for any other
> services.
>
> Reject such service connection responses.
>
> Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
>
> Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
> Reported-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
2023-05-16 15:04 ` [PATCH v2] " Fedor Pchelkin
2023-05-16 19:47 ` Toke Høiland-Jørgensen
@ 2023-05-25 17:04 ` Kalle Valo
1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2023-05-25 17:04 UTC (permalink / raw)
To: Fedor Pchelkin
Cc: Toke Høiland-Jørgensen, Fedor Pchelkin,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
linux-wireless, netdev, linux-kernel, Takeshi Misawa,
Alexey Khoroshilov, lvc-project, syzbot+b68fbebe56d8362907e8
Fedor Pchelkin <pchelkin@ispras.ru> wrote:
> A bad USB device is able to construct a service connection response
> message with target endpoint being ENDPOINT0 which is reserved for
> HTC_CTRL_RSVD_SVC and should not be modified to be used for any other
> services.
>
> Reject such service connection responses.
>
> Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
>
> Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
> Reported-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Patch applied to ath-next branch of ath.git, thanks.
061b0cb9327b wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230516150427.79469-1-pchelkin@ispras.ru/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-25 17:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-13 21:41 [PATCH] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes Fedor Pchelkin
2023-05-15 12:15 ` Toke Høiland-Jørgensen
2023-05-16 15:04 ` [PATCH v2] " Fedor Pchelkin
2023-05-16 19:47 ` Toke Høiland-Jørgensen
2023-05-25 17:04 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.