From patchwork Tue Dec 10 11:44:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11282015 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E021114E3 for ; Tue, 10 Dec 2019 11:45:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF8B62073B for ; Tue, 10 Dec 2019 11:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978350; bh=4MV+KVBTzamT6S5BA/G0IHJk9wTBETBkbTo/LZLmOB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eS6YDDioc/TpAteROzAIpiTFRvCadFNA2o9ZPw2DpLgrCjvjGWAxcxmuAR3kGyCQi hgKY9g6wJdqpP2Gou3Bey3z8HCpeVMmSTZbMEbY1vQe7opWFieCiyeaAn9t/crJCt/ X4dRWjXD92Mxe1EMtcXt5ogeF9xeJq4OYfgpki2w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727671AbfLJLop (ORCPT ); Tue, 10 Dec 2019 06:44:45 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36587 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727306AbfLJLop (ORCPT ); Tue, 10 Dec 2019 06:44:45 -0500 Received: by mail-lj1-f194.google.com with SMTP id r19so19536008ljg.3; Tue, 10 Dec 2019 03:44:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HIbOMPFeN5/NwJ3YbPrJKdOlArPlt1Io+T/N+aqc/UY=; b=hpMA7H6aMlCb5mifXdB4oWd67sveaziPwDWZ09YCsOajifr6nIP4UvOvvMLMEIl3uB Xgx1nXnVshAVX24BD05rIZw0I7fSQudC4GSyByGTXwt/U/n66Z6U0kMZwBMhGzK9BAmA 8vzFfvwBS0gp/Bsq8bJwSWc894WzPd/wlsQ9aWjsSciwru/3vrh/axqQD0JXyZviUrPM 5PVROogfjPAl3YFwlPK1ismTj82IyPutNxa8Dlx02513uKDVtJalZz/CKQ71ZBZBrwbI TE1bLCQl40t4Pd/zvuPrPkBAlFpj1Qh6dY4g1coXx9xF4UK/Ez4ivphhzB72PSAGDimI zYcw== X-Gm-Message-State: APjAAAW/Sv1+Smpx5s5cqUuXydrTBZxDMvUCvdD9ZJiw2raqsq7xKHo1 csEMSft0ibJREpSxm1/SIco= X-Google-Smtp-Source: APXvYqyK4ihZYY8oRV5G7F87li0Hb+55Iu5uAyn/mcP70GXX368WCtLm+NOOStcXbRXyaXs4PdIy3A== X-Received: by 2002:a2e:93d5:: with SMTP id p21mr20940877ljh.50.1575978283184; Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id r9sm1683726lfc.72.2019.12.10.03.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:42 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001Hn-BX; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 1/7] ath9k: fix storage endpoint lookup Date: Tue, 10 Dec 2019 12:44:20 +0100 Message-Id: <20191210114426.4713-2-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the storage interface descriptors to avoid submitting an URB to an invalid endpoint. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices") Cc: stable # 2.6.39 Signed-off-by: Johan Hovold --- drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index fb649d85b8fc..dd0c32379375 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -1216,7 +1216,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) static int send_eject_command(struct usb_interface *interface) { struct usb_device *udev = interface_to_usbdev(interface); - struct usb_host_interface *iface_desc = &interface->altsetting[0]; + struct usb_host_interface *iface_desc = interface->cur_altsetting; struct usb_endpoint_descriptor *endpoint; unsigned char *cmd; u8 bulk_out_ep; From patchwork Tue Dec 10 11:44:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11282007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7FE8E112B for ; Tue, 10 Dec 2019 11:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FBCA2073B for ; Tue, 10 Dec 2019 11:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978340; bh=rbUycGx9gUlIfbdz81Q/uowA7hYIYjXqn/v/eFl7Jvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=r0k6moZNpLpI5GOMHuS0B42x3eeyLOWWb8tgyqCtQiwakE6h8zU7bMslLRnpmCXAe YPlUgpvMGYlHuFdrgTFk0CScKifAr36dlNBLkgzyw1FIl27Z85k5eEdJMFznAYc7CZ 4dlAzfijYKxn/zMZw6ZpSvvOkSRC/5sEt7Tt7JgU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727733AbfLJLor (ORCPT ); Tue, 10 Dec 2019 06:44:47 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43490 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727441AbfLJLoq (ORCPT ); Tue, 10 Dec 2019 06:44:46 -0500 Received: by mail-lj1-f196.google.com with SMTP id a13so19498747ljm.10; Tue, 10 Dec 2019 03:44:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P3dSQCHRI36SjPWYo0brD43NEdcMsLd/xYS8Df+31B4=; b=WlI/+IAY2YpfyFWJfmsfGOhePWAYppvUGULiDGAnStzwa455XbZ2t6gJMLPcCbaPwG m4Bnm4rlGeRS9Xb2EQFGp87dMQ4/KpWY+LWg0piNiBaqd5eMVLSzfpiiUPA7TeLQWT8b LLZNjoDtz1bS/weBFHu62kuaj22U4KERbVb2q7fuQ1n5XC6BTr5/gnZAy1UE1+P2WdaT 3FeTK7HAV8yh4sC+iJsh5MHv+eBWGgRg1tg0D7Pq5tm6NK+lj4MC1XKPROZyBNO9Hqoh l8zeuUmPpvvXpmtsG6PIX8ss+Ig1dxS5lmLTdb7V0666bZGPtdWKH8FuQ/o45b9wNBEc Jr5w== X-Gm-Message-State: APjAAAWFl2e9vXxKpWUITq0+9EU/eSt+WPVrOP/TtIShUxij5h+aMYGt lWU5fSghRi65lASh6b/r8po= X-Google-Smtp-Source: APXvYqxLiCnWQg2+yXPqCdb9teaUE2XcyjKhLXsnKd7FWH2vE9SYKCnmXjufUvjYd9E8cLy+G53n5g== X-Received: by 2002:a2e:585e:: with SMTP id x30mr20943600ljd.141.1575978283741; Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id n14sm1419005lfe.5.2019.12.10.03.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:42 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001Hs-Eq; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/7] at76c50x-usb: fix endpoint debug message Date: Tue, 10 Dec 2019 12:44:21 +0100 Message-Id: <20191210114426.4713-3-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting, which may not be the same as the first alternate setting, also when printing the number of endpoints at probe. Signed-off-by: Johan Hovold --- drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c index db2c3b8d491e..3b2680772f03 100644 --- a/drivers/net/wireless/atmel/at76c50x-usb.c +++ b/drivers/net/wireless/atmel/at76c50x-usb.c @@ -2236,7 +2236,7 @@ static int at76_alloc_urbs(struct at76_priv *priv, at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __func__); at76_dbg(DBG_URB, "%s: NumEndpoints %d ", __func__, - interface->altsetting[0].desc.bNumEndpoints); + interface->cur_altsetting->desc.bNumEndpoints); ep_in = NULL; ep_out = NULL; From patchwork Tue Dec 10 11:44:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11282001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00A9014E3 for ; Tue, 10 Dec 2019 11:45:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D39F32073D for ; Tue, 10 Dec 2019 11:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978333; bh=WN/tO/s8YcvgofDepTRmHoiHmGaaocf4EphQ3TB+QIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Je/EvpjYbuQvZxrX18XIvaxHOd2Q8NaB4k1TFh7QpDCnPvPuVEpjHnaTf0GOrkEb8 zmw5EBDNeFbhHS2XHBZ5RfaU2Lvm/GolFk73XII9tu5lZP48Y4nmxXGznDU7AQo1qe KjU/oTknOOZ4erwFWv+LFUKd6rd2BZtlX1Vw1jkk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727527AbfLJLpW (ORCPT ); Tue, 10 Dec 2019 06:45:22 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36205 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727699AbfLJLor (ORCPT ); Tue, 10 Dec 2019 06:44:47 -0500 Received: by mail-lf1-f67.google.com with SMTP id n12so13466222lfe.3; Tue, 10 Dec 2019 03:44:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pnY+PJY7SPNBPbJBBIXQDigd1msQalbdBbCvxm59meA=; b=qZw7pAcCCjlp+sL+q4RnQpuvzhdNhBc96Y2S6dj7LIWrTw3RHpQWkUsk5aNAxPVPSt CNdf531LM2820HgnLechfjgo9CniTyKl1TeM9lg2yoxVcOqLZWwIsPyEvsW+R4hmC4xv S5EGFGwgX7B0pjLtFS9velhaffaQplAgq5Elvn0b+GZL9NCSQR+j1Q28TMp9ut45Me1s 6HWLsVeoDLRB7LRIrx5ItNys7KE6+GecSnUfQ0FeW9p9mpExyqtTwNrnF2f5iyJ4WAp7 sN/XksaWEef8Ilaw5lFloQ1JwvjRvLaRt9ymJLCMJhjouyDqA6Avo3Eb8cD8/1HgxFHQ L1vw== X-Gm-Message-State: APjAAAXmx3G7bGTimmONJUe5d8cF8hitGNuKibt7IBv3WrOYw8jc+s0Y +OYGn6oQzRegodelXft0k9I= X-Google-Smtp-Source: APXvYqwbNRbtj2Ow9aDvwjOtvOf4OiR4OleAxoH6lR3rQqOKq931QpA1xB3+eApd+1ggaGGzZnVx9g== X-Received: by 2002:ac2:44ce:: with SMTP id d14mr14176321lfm.140.1575978285036; Tue, 10 Dec 2019 03:44:45 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id a14sm1427974lfh.50.2019.12.10.03.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:42 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001Hx-HP; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 3/7] brcmfmac: fix interface sanity check Date: Tue, 10 Dec 2019 12:44:22 +0100 Message-Id: <20191210114426.4713-4-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets") Cc: stable # 3.4 Cc: Arend van Spriel Signed-off-by: Johan Hovold --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index 06f3c01f10b3..7cdfde9b3dea 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -1348,7 +1348,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) goto fail; } - desc = &intf->altsetting[0].desc; + desc = &intf->cur_altsetting->desc; if ((desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || (desc->bInterfaceSubClass != 2) || (desc->bInterfaceProtocol != 0xff)) { @@ -1361,7 +1361,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) num_of_eps = desc->bNumEndpoints; for (ep = 0; ep < num_of_eps; ep++) { - endpoint = &intf->altsetting[0].endpoint[ep].desc; + endpoint = &intf->cur_altsetting->endpoint[ep].desc; endpoint_num = usb_endpoint_num(endpoint); if (!usb_endpoint_xfer_bulk(endpoint)) continue; From patchwork Tue Dec 10 11:44:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11282003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 931DC14E3 for ; Tue, 10 Dec 2019 11:45:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 720BE2073B for ; Tue, 10 Dec 2019 11:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978336; bh=NHn5mK/szEBw/MrxrdLoXSJfgl4m+fQlUzxnCykBJIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zGqveLPjwrbU7t6V4koj1msu8hvCmJBWzewd3YAbN5s8zaIS5dKgw925owo4nD/8s yBl67Y8ZrMlfIHSRSUjZnRXWzsoO2aPbWGVr98b0p7eama3xRi6pDS8AbDcAQ6BkD2 EUtBsj+yHEUzgeRd3zTo12Pqfhf59NfGbhQZwQQk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727565AbfLJLpW (ORCPT ); Tue, 10 Dec 2019 06:45:22 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37414 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfLJLos (ORCPT ); Tue, 10 Dec 2019 06:44:48 -0500 Received: by mail-lj1-f196.google.com with SMTP id u17so19512419lja.4; Tue, 10 Dec 2019 03:44:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HPkUmO3G/A16rgtcZUNme6uiy2GoRkfbpmQRAn7AWJ8=; b=dQ7Oj5c8M+t5mw86y+GO8Lr4JA3roQ3I7gCesNcM68pUbkL/1Ivcjrfgy2tqdr6R9b w0B8SPVw3NTaqd+WqyCE8GeWApB8wIMqyCEsT1rElFPlHGgdBSyIKAOLRT9fpK6Yp7mQ oJK6eSS4Rvrf+Tv0ZSdEF4Ps07cllspTiK1d/Q56QeGtx63YZWOLue5R79VPicj62OP3 9FK7TEzrkgURvNmKD7a2D6wKcabk1GWB7ahqo/Xc8KgFdzyyRmvPVGhxKOrlQcnS07Ct o1GqN75JIbGRHr+4oYVgp60wJxBYybThamnJ4AfbdlNfMxt846Xef68HHIBh77qr6B7G i6nA== X-Gm-Message-State: APjAAAXYrJszBQuX9y92iUTMUGyKNMR9C6Eq973VgkrhdDSV8mrH1cSQ kFBcrduS83DaQO6qc0VwTOE= X-Google-Smtp-Source: APXvYqx0tCPUjbLt1rFx+WirJ499EdZwAdGnhgcl5nl1/qoH4tw61ZDHmQb2+1PkIRQexzMBKal9HA== X-Received: by 2002:a2e:9a11:: with SMTP id o17mr19813944lji.256.1575978285896; Tue, 10 Dec 2019 03:44:45 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id n19sm1361305lfl.85.2019.12.10.03.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001I2-Kf; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 4/7] orinoco_usb: fix interface sanity check Date: Tue, 10 Dec 2019 12:44:23 +0100 Message-Id: <20191210114426.4713-5-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 9afac70a7305 ("orinoco: add orinoco_usb driver") Cc: stable # 2.6.35 Signed-off-by: Johan Hovold --- drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c index 40a8b941ad5c..8c79b963bcff 100644 --- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c @@ -1608,9 +1608,9 @@ static int ezusb_probe(struct usb_interface *interface, /* set up the endpoint information */ /* check out the endpoints */ - iface_desc = &interface->altsetting[0].desc; + iface_desc = &interface->cur_altsetting->desc; for (i = 0; i < iface_desc->bNumEndpoints; ++i) { - ep = &interface->altsetting[0].endpoint[i].desc; + ep = &interface->cur_altsetting->endpoint[i].desc; if (usb_endpoint_is_bulk_in(ep)) { /* we found a bulk in endpoint */ From patchwork Tue Dec 10 11:44:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11281989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26C8A112B for ; Tue, 10 Dec 2019 11:45:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 059272073D for ; Tue, 10 Dec 2019 11:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978314; bh=egy0NrKkLQXTSdqhOQ4Z+RjieKlyJfsQSL53TruPycw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xbUhk0KNS0rG9ApwpShh238jUAYNKD/3phFeycsmI8y+lOL+BnCTNuKAsS8ezNhBb UcNmgihaBX+UQ3ihcAUsUvSFYrRdCDRWPb9Qti1UNaXXT/L59qphX8jwQr7Ue2zIvw OZ4xYR1mswF+a6b0i2d5eELpCd+5R0/aW7JAQr+c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727784AbfLJLox (ORCPT ); Tue, 10 Dec 2019 06:44:53 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:37980 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727730AbfLJLos (ORCPT ); Tue, 10 Dec 2019 06:44:48 -0500 Received: by mail-lj1-f194.google.com with SMTP id k8so19469742ljh.5; Tue, 10 Dec 2019 03:44:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F3MUQ+LoTrV2G6U9Nx6QBaOEztQsCtDS4fhJs3lb6uk=; b=WQjHRa1Rd9HrJDvYvp+V5fv1u0o04jD+0dPjwlccq09x1hliNur938by9zCheSeX/N jpmtRaKQVjXuBsAluezv6budmd/28xuiVRf2znnpT/3xGF+ILsOEn7WgsHVHU9d+EaQ9 Gn87D+pZY/al0I99Hh5WUZwtHidEsaJRU0Yv5Y9/ZTubJ6zfpGt/Zo0g0sefE5g0NB7j CkGFAKf3DuSxWkcei37F/h05y/r5BvZVERRuaDzbgUid5n87FH+KHezgYTCtcWzQVFd9 ogBGB0xB7RJ2RLKJNFBX5NQwkFarda+tmqBZFYm23PcF2LrzDbYA3/z8TdWdMjN00Qao dd9g== X-Gm-Message-State: APjAAAUZKOACTcvFph2mhOEQaNZpVSCdAG2lgAeLtMJ6gRw8UUqWeWNo l7ZcLRfClfVU3kuc/PCvo5A= X-Google-Smtp-Source: APXvYqw03jFaxhFit7cE2chDwKeaHkFNy6WoFDjYlzs0rvx/sssv7BW88ZQ6ko03rUmUBzFNEZlD+g== X-Received: by 2002:a05:651c:112c:: with SMTP id e12mr20374152ljo.169.1575978286314; Tue, 10 Dec 2019 03:44:46 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id q27sm1634622ljm.25.2019.12.10.03.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001I8-No; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 5/7] rtl8xxxu: fix interface sanity check Date: Tue, 10 Dec 2019 12:44:24 +0100 Message-Id: <20191210114426.4713-6-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Cc: stable # 4.4 Cc: Jes Sorensen Signed-off-by: Johan Hovold --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index aa2bb2ae9809..54a1a4ea107b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -6384,7 +6384,7 @@ static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv, u8 dir, xtype, num; int ret = 0; - host_interface = &interface->altsetting[0]; + host_interface = interface->cur_altsetting; interface_desc = &host_interface->desc; endpoints = interface_desc->bNumEndpoints; From patchwork Tue Dec 10 11:44:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11281995 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB99315AB for ; Tue, 10 Dec 2019 11:45:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C98E620836 for ; Tue, 10 Dec 2019 11:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978321; bh=fdlzGZUtU2XiWRM/+oZVZ81jIqcjYgrX+MflMMtnQsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=g+CvwbyShcAVwTOkbcJwgexHtcPprgMLM7isrpgCqCUjIyRarMzI/SUKYGWYxQkcj LltjbGnRmYZzNEnTxCksJm0b4s8RReoHQcocav/hoiqEhBP4L5ZgXLG3QeC9r2bqed d/1TAyTII7UtQe4JlxLaEVkLokmGLe9Fg3GtFkDU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727773AbfLJLow (ORCPT ); Tue, 10 Dec 2019 06:44:52 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37418 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727750AbfLJLot (ORCPT ); Tue, 10 Dec 2019 06:44:49 -0500 Received: by mail-lj1-f195.google.com with SMTP id u17so19512504lja.4; Tue, 10 Dec 2019 03:44:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mVv+98+Q/wUUkUyC3i7eT9Xaj/qNxPXqvi+D40LBxA8=; b=AT516+M1D0z38nsihUQaSLomQPXc7jErJf1yTvIh7l1jB3NGdeLF+f5TO7+vhAno/t AgLWcVqM2Pb4+ltOXx/s6I9mpcaLJsLgu1ES7eG1mYFZ0YIdYo9jSxGKpLZTmWEh1qVq hVJYlK4CGfgsK073vpNc/Jp6sWCXVGV9meXsEidAC2V/23dZOj/5xRXhXQUYw/54I/N9 X6dkxDZQtVs4pMkP90FOsqa5e0eeeB2bkMsE+8VgClVeRm5RVPyj9eGEz4m+mO5kUwmG U36PedmtIxZLJCAC+nmqgrZbP5c0kg03Nap2MCbrpDiJ3LTCPU8R4Zv3vLT336S7OLKN lIyQ== X-Gm-Message-State: APjAAAWrTyXnc0S7MhZ/Tu9pPZ+ssPEoGch+eOXV2MN2mbFZse6aU6AD M0X1nxd9VYMg1ShGP55x1m0= X-Google-Smtp-Source: APXvYqzNFa+fn53W1Aqp5M1Cpv1wJ6sddSRmDkbQiSSYG/sew6XIoKADsYtUfOLhzdKYpYDnENl+pw== X-Received: by 2002:a2e:3a13:: with SMTP id h19mr20770639lja.16.1575978287183; Tue, 10 Dec 2019 03:44:47 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id q10sm1583883ljj.60.2019.12.10.03.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001ID-QQ; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Fariya Fatima Subject: [PATCH 6/7] rsi_91x_usb: fix interface sanity check Date: Tue, 10 Dec 2019 12:44:25 +0100 Message-Id: <20191210114426.4713-7-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: dad0d04fa7ba ("rsi: Add RS9113 wireless driver") Cc: stable # 3.15 Cc: Fariya Fatima Signed-off-by: Johan Hovold --- drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index a37a436df5fb..c3ba38ed0dd0 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -117,7 +117,7 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface, __le16 buffer_size; int ii, bin_found = 0, bout_found = 0; - iface_desc = &(interface->altsetting[0]); + iface_desc = interface->cur_altsetting; for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) { endpoint = &(iface_desc->endpoint[ii].desc); From patchwork Tue Dec 10 11:44:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11281985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CAFF14E3 for ; Tue, 10 Dec 2019 11:45:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B5CB207FF for ; Tue, 10 Dec 2019 11:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575978311; bh=mcq1zqd2ZgueCQz3xA7qaEUarto6aOD6uJIn7WW43Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iPomfvEZZxHJRX9uDQvdd1UXRnm2WJnI9snFfW/oymI7kbUaoycMqI2YNzdV7qTXA fRpfGBUI+waTDfWNp/rxDWyZlh8CfPCVFfXFkVsdT5/K199/kIwCFpl7EN42uEOxEY Km1gSPmjLHu9wzKR1LdpGCrCugFt9d9WS0IcfjM8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbfLJLox (ORCPT ); Tue, 10 Dec 2019 06:44:53 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42735 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbfLJLot (ORCPT ); Tue, 10 Dec 2019 06:44:49 -0500 Received: by mail-lj1-f194.google.com with SMTP id e28so19473404ljo.9; Tue, 10 Dec 2019 03:44:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qWOB2/IV9LlS7RQezdilUBmbfySScHur6xA52oFN8Mk=; b=Q2NcCZ9MkksL/3NQxvpoyzOR6VBFKo9p5yK/8B6NjPgFUfI3t6ZsTrMcwRVlM1iMYy lcs484KF5ZFwH90hZC9hK7Yb9hj6BCUxyjQVi1XeVWZ3hdPawEYFAmSiF7HM6snygMsM VxaD/DYKZ6BNgNcqNH5wg9WK4Z1/cwn2sKLrz35Wudcc1W8tbPqXfX+UuQGcne75voB6 MTjGIjYX2MF2epTY2TwmTLkGm/3bJZcKfSxIWSuE0uIrU/N1ZHmqmtfhgmc9fdNyWxx+ wgQjhB6YARFsH8Cmzy7P4SRhsy8IHavrPIRWnT50nnDcIMURZ/zxck3PjJ1SPXW+V4zj pTjQ== X-Gm-Message-State: APjAAAWJDqm4L3C20tKD48CfAkWW6hICiueJ15Tc2pFfSVDwHkcOgdVM l/jlGPVXmeuk6xspFlWtsMc= X-Google-Smtp-Source: APXvYqynsdHOtBWjaFSURKa7gPhmEPTZGQhZLn7lMHihEI1WubA2H/zTUly8AXEPYsJuWUpQ+LO9+w== X-Received: by 2002:a2e:5850:: with SMTP id x16mr1332994ljd.228.1575978287598; Tue, 10 Dec 2019 03:44:47 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id x84sm1425212lfa.97.2019.12.10.03.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:44:43 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iedwa-0001II-Td; Tue, 10 Dec 2019 12:44:44 +0100 From: Johan Hovold To: Kalle Valo Cc: QCA ath9k Development , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Jes Sorensen , Amitkumar Karwar , Siva Rebbagondla , Daniel Drake , Ulrich Kunitz , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 7/7] zd1211rw: fix storage endpoint lookup Date: Tue, 10 Dec 2019 12:44:26 +0100 Message-Id: <20191210114426.4713-8-johan@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210114426.4713-1-johan@kernel.org> References: <20191210114426.4713-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Make sure to use the current alternate setting when verifying the storage interface descriptors to avoid submitting an URB to an invalid endpoint. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: a1030e92c150 ("[PATCH] zd1211rw: Convert installer CDROM device into WLAN device") Cc: stable # 2.6.19 Signed-off-by: Johan Hovold --- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c index 7b5c2fe5bd4d..8ff0374126e4 100644 --- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c @@ -1263,7 +1263,7 @@ static void print_id(struct usb_device *udev) static int eject_installer(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); - struct usb_host_interface *iface_desc = &intf->altsetting[0]; + struct usb_host_interface *iface_desc = intf->cur_altsetting; struct usb_endpoint_descriptor *endpoint; unsigned char *cmd; u8 bulk_out_ep;