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;