aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald Wahl <ronald.wahl@raritan.com>2014-08-07 08:15:50 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-08-11 14:43:51 -0400
commit671796dd96b6cd85b75fba9d3007bcf7e5f7c309 (patch)
tree635e97909c7ee868d100ccf57be4bf5accb126ff
parent33caee39925b887a99a2400dc5c980097c3573f9 (diff)
carl9170: fix sending URBs with wrong type when using full-speed
The driver assumes that endpoint 4 is always an interrupt endpoint. Unfortunately the type differs between high-speed and full-speed configurations while in the former case it is indeed an interrupt endpoint this is not true for the latter case - here it is a bulk endpoint. When sending URBs with the wrong type the kernel will generate a warning message including backtrace. In this specific case there will be a huge amount of warnings which can bring the system to freeze. To fix this we are now sending URBs to endpoint 4 using the type found in the endpoint descriptor. A side note: The carl9170 firmware currently specifies endpoint 4 as interrupt endpoint even in the full-speed configuration but this has no relevance because before this firmware is loaded the endpoint type is as described above and after the firmware is running the stick is not reenumerated and so the old descriptor is used. Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com> Cc: <stable@vger.kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c31
2 files changed, 28 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index 8596aba34f96..237d0cda1bcb 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -256,6 +256,7 @@ struct ar9170 {
256 atomic_t rx_work_urbs; 256 atomic_t rx_work_urbs;
257 atomic_t rx_pool_urbs; 257 atomic_t rx_pool_urbs;
258 kernel_ulong_t features; 258 kernel_ulong_t features;
259 bool usb_ep_cmd_is_bulk;
259 260
260 /* firmware settings */ 261 /* firmware settings */
261 struct completion fw_load_wait; 262 struct completion fw_load_wait;
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index f35c7f30f9a6..c9f93310c0d6 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -621,9 +621,16 @@ int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd,
621 goto err_free; 621 goto err_free;
622 } 622 }
623 623
624 usb_fill_int_urb(urb, ar->udev, usb_sndintpipe(ar->udev, 624 if (ar->usb_ep_cmd_is_bulk)
625 AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, 625 usb_fill_bulk_urb(urb, ar->udev,
626 carl9170_usb_cmd_complete, ar, 1); 626 usb_sndbulkpipe(ar->udev, AR9170_USB_EP_CMD),
627 cmd, cmd->hdr.len + 4,
628 carl9170_usb_cmd_complete, ar);
629 else
630 usb_fill_int_urb(urb, ar->udev,
631 usb_sndintpipe(ar->udev, AR9170_USB_EP_CMD),
632 cmd, cmd->hdr.len + 4,
633 carl9170_usb_cmd_complete, ar, 1);
627 634
628 if (free_buf) 635 if (free_buf)
629 urb->transfer_flags |= URB_FREE_BUFFER; 636 urb->transfer_flags |= URB_FREE_BUFFER;
@@ -1032,9 +1039,10 @@ static void carl9170_usb_firmware_step2(const struct firmware *fw,
1032static int carl9170_usb_probe(struct usb_interface *intf, 1039static int carl9170_usb_probe(struct usb_interface *intf,
1033 const struct usb_device_id *id) 1040 const struct usb_device_id *id)
1034{ 1041{
1042 struct usb_endpoint_descriptor *ep;
1035 struct ar9170 *ar; 1043 struct ar9170 *ar;
1036 struct usb_device *udev; 1044 struct usb_device *udev;
1037 int err; 1045 int i, err;
1038 1046
1039 err = usb_reset_device(interface_to_usbdev(intf)); 1047 err = usb_reset_device(interface_to_usbdev(intf));
1040 if (err) 1048 if (err)
@@ -1050,6 +1058,21 @@ static int carl9170_usb_probe(struct usb_interface *intf,
1050 ar->intf = intf; 1058 ar->intf = intf;
1051 ar->features = id->driver_info; 1059 ar->features = id->driver_info;
1052 1060
1061 /* We need to remember the type of endpoint 4 because it differs
1062 * between high- and full-speed configuration. The high-speed
1063 * configuration specifies it as interrupt and the full-speed
1064 * configuration as bulk endpoint. This information is required
1065 * later when sending urbs to that endpoint.
1066 */
1067 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; ++i) {
1068 ep = &intf->cur_altsetting->endpoint[i].desc;
1069
1070 if (usb_endpoint_num(ep) == AR9170_USB_EP_CMD &&
1071 usb_endpoint_dir_out(ep) &&
1072 usb_endpoint_type(ep) == USB_ENDPOINT_XFER_BULK)
1073 ar->usb_ep_cmd_is_bulk = true;
1074 }
1075
1053 usb_set_intfdata(intf, ar); 1076 usb_set_intfdata(intf, ar);
1054 SET_IEEE80211_DEV(ar->hw, &intf->dev); 1077 SET_IEEE80211_DEV(ar->hw, &intf->dev);
1055 1078