Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2094582ybl; Thu, 30 Jan 2020 11:15:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwSzy+o+QGKYSjaO3t+MCokCJuZcj7nOwjWbDvLppsNqtS5Zt8ZVj9hfSBkaQSi5I4rtfUS X-Received: by 2002:a9d:7757:: with SMTP id t23mr4861372otl.315.1580411732673; Thu, 30 Jan 2020 11:15:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411732; cv=none; d=google.com; s=arc-20160816; b=wPw7yCMthEbIpfGFASpHqpM1MoaZFwgugzNbvPWayNqCyMQQEPhB41nwWzlmRWV3GD 15YNveDMqnnxl4l/QNG1uUmrOBJJOHSR2FtwVvP7AKyvSa3g+8tPaOGuM6DquZMcvKIb xqOvW8uYgpgi4ujUfGn1R0c9qe/0ZbU8ZV+fVJ5W/MFLDWB7bn2Y/qfkC0TvcFjqtoZ3 9w7b2uNe+HZ5MZvDDK4oQl2AkO0MTK40yzS5Vl3RBdtx92hJ09TKF3qhnEBKZCyc2lPC NHo8odLwhODengAravWK1nfSwOdlOFB8+398Y36if4EoVGEwLrQBlR8JnQttom2mfq8p Ugkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6XBTHGdsuv17soQHQJyleRcqRU0hDhyggNRJBl6Wzdo=; b=lE8sdKKQpp1L4isn42O2IUcc3JqK0JeazfqWPc2etgPSJC79CR9zygev45exEMIVgC lriAgdZI0hM52p+bcqoiNPJVJrHTOmk/u2SYytJt28yMsnzhmR5+++GXYLa/Zp/ngSvJ AsQR+BkHINgACsi9PwAigj9Pon89GOf6/OhK3HXUoHbA1TruvfOHbQtvAXLoFvAzYc4B cmcqghqaiDc0+30UYlHhPne9UR0Wnaal3ola8XXBjHfGpJYujdr/91QjTOlAvvGs+YFA 3XZ8MvkNOhCedwAuH0qkcQpTXvAELThLp/e/qp1ia+E40TlwNH45bqPa//q+YzMaKeml bUmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E0k2XNu2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si3123110oiv.13.2020.01.30.11.15.20; Thu, 30 Jan 2020 11:15:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E0k2XNu2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730315AbgA3SmG (ORCPT + 99 others); Thu, 30 Jan 2020 13:42:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:50196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730303AbgA3SmD (ORCPT ); Thu, 30 Jan 2020 13:42:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A25120CC7; Thu, 30 Jan 2020 18:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409722; bh=1M0YF0+4pADEq3v0NcUXt1p5XFbnlgw9zdlVcdV/OZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0k2XNu2wki/cbh6MsSs4vBD91AOW+1hxySFrgtY1eAU3o+lf9e1e2AScnXfWRkas 7JisrN1B3qJlvTBSF+SomH/iSQ3AOffqDx36Cta9PLjUQ/rZCKt1shrYP/30wkahNB xRJjs19GDB0IfiFtKYNYOL0fJntzQJa++fPsEgJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arend van Spriel , Johan Hovold , Kalle Valo Subject: [PATCH 5.5 33/56] brcmfmac: fix interface sanity check Date: Thu, 30 Jan 2020 19:38:50 +0100 Message-Id: <20200130183615.067958605@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.849023566@linuxfoundation.org> References: <20200130183608.849023566@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 3428fbcd6e6c0850b1a8b2a12082b7b2aabb3da3 upstream. 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 Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- 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 *in 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 *in 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;