wireless: fix USB altsetting bugs
Subsystems (12)
cover wireless: fix USB altsetting bugs
We had quite a few drivers using the first alternate setting instead of the current one when doing descriptor sanity checks. This is mostly an issue on kernels with panic_on_warn set due to a WARN() in usb_submit_urb(), but since we've started backporting such fixes (e.g. as reported by syzbot), I've marked these for stable as well.
Johan
Johan Hovold (7):
ath9k: fix storage endpoint lookup
at76c50x-usb: fix endpoint debug message
brcmfmac: fix interface sanity check
orinoco_usb: fix interface sanity check
rtl8xxxu: fix interface sanity check
rsi_91x_usb: fix interface sanity check
zd1211rw: fix storage endpoint lookup
drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +- drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++-- drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 4 ++-- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.24.0
PATCH 1/7 ath9k: fix storage endpoint lookup
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.
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +1 -1
@@ -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;
Signature · 1 line
2.24.0
Re: [PATCH 1/7] ath9k: fix storage endpoint lookup
Quoted 11 lines · Johan Hovold
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()inusb_submit_urb()that kernels withpanic_on_warnset would choke on.Fixes 36bcce430657 ("ath9k_htc: Handle storage devices")Cc stable <[email protected]> # 2.6.39Signed-off-by Johan Hovold <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
0ef332951e85 ath9k: fix storage endpoint lookup
Signature · 3 lines
https://patchwork.kernel.org/patch/11282013/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 2/7 at76c50x-usb: fix endpoint debug message
In reply to Johan HovoldMake 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.
--- drivers/net/wireless/atmel/at76c50x-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/atmel/at76c50x-usb.c +1 -1
@@ -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 ;
Signature · 1 line
2.24.0
Re: [PATCH 2/7] at76c50x-usb: fix endpoint debug message
Quoted 5 lines · Johan Hovold
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 <[email protected]>
6 patches applied to wireless-drivers-next.git, thanks.
af615abd1596 at76c50x-usb: fix endpoint debug message 3428fbcd6e6c brcmfmac: fix interface sanity check b73e05aa543c orinoco_usb: fix interface sanity check 39a4281c312f rtl8xxxu: fix interface sanity check 3139b180906a rsi_91x_usb: fix interface sanity check 2d68bb2687ab zd1211rw: fix storage endpoint lookup
Signature · 3 lines
https://patchwork.kernel.org/patch/11282005/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 3/7 brcmfmac: fix interface sanity check
In reply to Johan HovoldMake 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.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +2 -2
@@ -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 ;
Signature · 1 line
2.24.0
PATCH 4/7 orinoco_usb: fix interface sanity check
In reply to Johan HovoldMake 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.
--- drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intersil/orinoco/orinoco_usb.c +2 -2
@@ -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 */
Signature · 1 line
2.24.0
PATCH 5/7 rtl8xxxu: fix interface sanity check
In reply to Johan HovoldMake 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.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -1
@@ -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;
Signature · 1 line
2.24.0
PATCH 6/7 rsi_91x_usb: fix interface sanity check
In reply to Johan HovoldMake 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.
--- drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +1 -1
@@ -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);
Signature · 1 line
2.24.0
PATCH 7/7 zd1211rw: fix storage endpoint lookup
In reply to Johan HovoldMake 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.
--- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/zydas/zd1211rw/zd_usb.c +1 -1
@@ -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;
Signature · 1 line
2.24.0