Message ID | 20230516150427.79469-1-pchelkin@ispras.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp497880vqo; Tue, 16 May 2023 08:07:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WnYxg16JKYecTCA+3oFWIzagOJks3VAW+xpiGxnm24VvqQZ0n5uumBusdtzF2Gg/iVATA X-Received: by 2002:a05:6808:2223:b0:394:643b:cd77 with SMTP id bd35-20020a056808222300b00394643bcd77mr11130186oib.44.1684249638914; Tue, 16 May 2023 08:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684249638; cv=none; d=google.com; s=arc-20160816; b=hhwSJpBojn2mFA/O5iApq9OyfmsBOqYOuZuDKDMRCo7NjiKhCddExVwto8lWHj0x/h JaTWvaN6rkjZeNFsUJfgFiy7X/GnqPxK06U8sbDYiwxUxTBCO/dWQfNCBnYJuMdxJXmQ EUzPRX3ERyHpHWyILVg7of9PCmL6aZeL+wcQkuPj1ZbV6pcrQYFNHixrN3VQMZGVh3YG 0Q2fE7oQ7jWu0eR1y8/D8BBcm36TltwL4B9cLCLsa5ZyvDWaft3H67na62RkPZZ4WMNw MncOkgzt67ylMNqOxgd/w9Fj5mim2vUB641hZu21/DzC/Qs/vH5s9OIr3G27VAh1UikQ Ti3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=sZ8kkT2TGWjUcst/Jgp8zQv5admnxY/XlfH+0rjhVWY=; b=I9REdxFrFQNxeVmHA4qCTK2HOjqSUsel6DKr7ZlNEAc3PfgA0K6beW61ZtbCmAfWOb eHH7xR9hE3xAAZrnAzjsppdJ3vcG3nIN+wdnF6SXDGa+llYkSqn1au93SPOD4d90RB6w 65E5G73k8BVuCVaeslW2TAFj5bc9vEayMz+Zpc/aigS3Fif5U5ZDlt9OYOKGaO5FpkI6 DrsC0tJ7ODcR7VR2derIapvcsML984i2eGzy5njzxpcJ/oAwIo3VwxU9OJQ9zVEeSXlt Axq2i3J1dfeFE0jBgAPIlounbDFGEjKwi4wuErvuWvI0sfkGAuVByudY4w4AMTjZyIUU ZTTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=PZW38xBv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020a4a3950000000b005518ada7718si8705833oog.64.2023.05.16.08.07.04; Tue, 16 May 2023 08:07:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=PZW38xBv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233656AbjEPPEt (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Tue, 16 May 2023 11:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233106AbjEPPEm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 16 May 2023 11:04:42 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69BA35B80; Tue, 16 May 2023 08:04:40 -0700 (PDT) Received: from fpc.. (unknown [46.242.14.200]) by mail.ispras.ru (Postfix) with ESMTPSA id 120DC40737D7; Tue, 16 May 2023 15:04:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 120DC40737D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1684249477; bh=sZ8kkT2TGWjUcst/Jgp8zQv5admnxY/XlfH+0rjhVWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZW38xBv9YAKyWUNlJmGaX05OwbSKR+p9YK4imq8ULOPNbmusdvStSlQcMMaSgtoB V9NsgMKaJyiAsyZX2d43eIs0ZzsdGjAPeLeQXiWb32r68tRCbwyTs/cAuukSD0Dm71 4C9zKY5MKF8FMSuY86+egeIDyCdQVn9Xw451cvo8= From: Fedor Pchelkin <pchelkin@ispras.ru> To: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk> Cc: Fedor Pchelkin <pchelkin@ispras.ru>, Kalle Valo <kvalo@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Takeshi Misawa <jeliantsurux@gmail.com>, Alexey Khoroshilov <khoroshilov@ispras.ru>, lvc-project@linuxtesting.org, syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com Subject: [PATCH v2] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes Date: Tue, 16 May 2023 18:04:27 +0300 Message-Id: <20230516150427.79469-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <87r0rhdc46.fsf@toke.dk> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765818265452360142?= X-GMAIL-MSGID: =?utf-8?q?1766063749086911477?= |
Series |
[v2] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
|
|
Commit Message
Fedor Pchelkin
May 16, 2023, 3:04 p.m. UTC
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(-)
Comments
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>
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
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);