Skip to content

Commit 061b0cb

Browse files
pchelkin91kvalo
authored andcommitted
wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
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: fb9987d ("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> Link: https://lore.kernel.org/r/20230516150427.79469-1-pchelkin@ispras.ru
1 parent 27044b5 commit 061b0cb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/wireless/ath/ath9k/htc_hst.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ static void htc_process_conn_rsp(struct htc_target *target,
114114

115115
if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) {
116116
epid = svc_rspmsg->endpoint_id;
117-
if (epid < 0 || epid >= ENDPOINT_MAX)
117+
118+
/* Check that the received epid for the endpoint to attach
119+
* a new service is valid. ENDPOINT0 can't be used here as it
120+
* is already reserved for HTC_CTRL_RSVD_SVC service and thus
121+
* should not be modified.
122+
*/
123+
if (epid <= ENDPOINT0 || epid >= ENDPOINT_MAX)
118124
return;
119125

120126
service_id = be16_to_cpu(svc_rspmsg->service_id);

0 commit comments

Comments
 (0)