Message ID | 20230513214146.120963-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 b10csp5989182vqo; Sat, 13 May 2023 15:05:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7///ldyC/SS7R77y76mBeDM6opV9d+DLYX8OTPCaIjopgRlMTipQ64lrj8wxEaPruZWQrE X-Received: by 2002:a05:6a00:2e85:b0:63b:6d4d:4c9 with SMTP id fd5-20020a056a002e8500b0063b6d4d04c9mr43251435pfb.9.1684015527426; Sat, 13 May 2023 15:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684015527; cv=none; d=google.com; s=arc-20160816; b=htySiYcSCdrzqDPfnh4aUSbapPWLvxR6we+T/8ZfXXmMx8JltQqBARSPuK+QddjsLF gS533tf7bUHl9vZU6ldOuZOYVxU80xaPQweRrpLq1lfMuXjSaWNf7+85C+d/lB1mmJm9 mVyuxwVDzY+0d5cx0TE1lel+/xDsX0Lrz6EWnp8HkAB5k/E1mdtvwMOX6iBfW/y4qJOD OofeGv8v9Y0yiZ2toFtGhT9h56BbwXBV/9d1b1xG6NjDNdbotXFYgQG6tn0kXXFIMAR8 6GuXJJ1tZvZ9G7OVn8/v9VfIz67KfM8VhBlA0guyQMHHocotLTiLMlfCM6lrzxQC5yVE HXIQ== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=6rJLFQzTqQuln9eGYgx3BvQDSlEIAh0h1G71nSAdqhM=; b=vYMruh9DjlTB9EYbMQ3mhkgaNfvIkBs9H5eexWwMrpBanNOIPyBFbLRi6imZ9c/Mrh MQUTWBoBD4M3K/hLaj8r6wUFgS88wEBAjqmDiufH2LiBoywiiZDANL/zOHVPPJZ6iQsp O11iE91QXCIR43dLCrKnLAPyO/hOYKy7B9T6hsdWXANAcPJjqA8ev8Nxg9s5TUxz/+Mc fNNZBa5N8CCB/1A5s8bXOjfsWrKvCnmnamQqu7yVPXhjkPmaWw+mhwuNpEq2St2K61Sh kluvYUG3lN9eoJvzAh2rGQcBPi5l/XMcQG3efHomaNoUHJL8nNuHO+fAaPOmOI4XBonI DGWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=k9KSWGlI; 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 e10-20020aa7980a000000b0063b87f60f7bsi13722218pfl.48.2023.05.13.15.05.10; Sat, 13 May 2023 15:05:27 -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=k9KSWGlI; 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 S231185AbjEMVmH (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Sat, 13 May 2023 17:42:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjEMVmG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 13 May 2023 17:42:06 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807482720; Sat, 13 May 2023 14:42:05 -0700 (PDT) Received: from fpc.intra.ispras.ru (unknown [10.10.165.8]) by mail.ispras.ru (Postfix) with ESMTPSA id 9E12E44C1012; Sat, 13 May 2023 21:42:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 9E12E44C1012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1684014123; bh=6rJLFQzTqQuln9eGYgx3BvQDSlEIAh0h1G71nSAdqhM=; h=From:To:Cc:Subject:Date:From; b=k9KSWGlIEpOYLlMwhxUF82/VVZlhZ+BvdDYsi8ZAyB9O8IUdFKawCuVsHX/evAMBT shuB4nuBRMXGU4o11FN4sppoCgMcDfm7mt553lgz2Ep0Ek6rmJnVczZtPAvQw4WcSl 2xp01YsVkoD7ZL6Fb+bkxHewqHBpoNKoPW9Mg9c4= From: Fedor Pchelkin <pchelkin@ispras.ru> To: Kalle Valo <kvalo@kernel.org> Cc: Fedor Pchelkin <pchelkin@ispras.ru>, =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8?= =?utf-8?q?rgensen?= <toke@toke.dk>, "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] wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes Date: Sun, 14 May 2023 00:41:46 +0300 Message-Id: <20230513214146.120963-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.34.1 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?1765818265452360142?= |
Series |
wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
|
|
Commit Message
Fedor Pchelkin
May 13, 2023, 9:41 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>
---
drivers/net/wireless/ath/ath9k/htc_hst.c | 2 +-
1 file changed, 1 insertion(+), 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> > --- > 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
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);