| From: Johan Hovold <johan@kernel.org> |
| Date: Tue, 10 Dec 2019 12:44:22 +0100 |
| Subject: brcmfmac: fix interface sanity check |
| |
| 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: Arend van Spriel <arend@broadcom.com> |
| Signed-off-by: Johan Hovold <johan@kernel.org> |
| Signed-off-by: Kalle Valo <kvalo@codeaurora.org> |
| [bwh: Backported to 3.16: |
| - Altsetting lookup is done by the IFALTS() macro |
| - Adjust filename] |
| Signed-off-by: Ben Hutchings <ben@decadent.org.uk> |
| --- |
| --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c |
| +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c |
| @@ -41,7 +41,7 @@ |
| |
| #define CONFIGDESC(usb) (&((usb)->actconfig)->desc) |
| #define IFPTR(usb, idx) ((usb)->actconfig->interface[(idx)]) |
| -#define IFALTS(usb, idx) (IFPTR((usb), (idx))->altsetting[0]) |
| +#define IFALTS(usb, idx) (*IFPTR((usb), (idx))->cur_altsetting) |
| #define IFDESC(usb, idx) IFALTS((usb), (idx)).desc |
| #define IFEPDESC(usb, idx, ep) (IFALTS((usb), (idx)).endpoint[(ep)]).desc |
| |