diff options
-rw-r--r-- | drivers/net/usb/rndis_host.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 4 | ||||
-rw-r--r-- | include/linux/usb/rndis_host.h | 3 |
3 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index ae467f182c40..61c98beb4d17 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(rndis_status); | |||
74 | * Call context is likely probe(), before interface name is known, | 74 | * Call context is likely probe(), before interface name is known, |
75 | * which is why we won't try to use it in the diagnostics. | 75 | * which is why we won't try to use it in the diagnostics. |
76 | */ | 76 | */ |
77 | int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf) | 77 | int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen) |
78 | { | 78 | { |
79 | struct cdc_state *info = (void *) &dev->data; | 79 | struct cdc_state *info = (void *) &dev->data; |
80 | int master_ifnum; | 80 | int master_ifnum; |
@@ -121,7 +121,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf) | |||
121 | USB_CDC_GET_ENCAPSULATED_RESPONSE, | 121 | USB_CDC_GET_ENCAPSULATED_RESPONSE, |
122 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 122 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
123 | 0, master_ifnum, | 123 | 0, master_ifnum, |
124 | buf, CONTROL_BUFFER_SIZE, | 124 | buf, buflen, |
125 | RNDIS_CONTROL_TIMEOUT_MS); | 125 | RNDIS_CONTROL_TIMEOUT_MS); |
126 | if (likely(retval >= 8)) { | 126 | if (likely(retval >= 8)) { |
127 | msg_len = le32_to_cpu(buf->msg_len); | 127 | msg_len = le32_to_cpu(buf->msg_len); |
@@ -239,7 +239,7 @@ static int rndis_query(struct usbnet *dev, struct usb_interface *intf, | |||
239 | u.get->len = cpu_to_le32(in_len); | 239 | u.get->len = cpu_to_le32(in_len); |
240 | u.get->offset = ccpu2(20); | 240 | u.get->offset = ccpu2(20); |
241 | 241 | ||
242 | retval = rndis_command(dev, u.header); | 242 | retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE); |
243 | if (unlikely(retval < 0)) { | 243 | if (unlikely(retval < 0)) { |
244 | dev_err(&intf->dev, "RNDIS_MSG_QUERY(0x%08x) failed, %d\n", | 244 | dev_err(&intf->dev, "RNDIS_MSG_QUERY(0x%08x) failed, %d\n", |
245 | oid, retval); | 245 | oid, retval); |
@@ -328,7 +328,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
328 | u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); | 328 | u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); |
329 | 329 | ||
330 | net->change_mtu = NULL; | 330 | net->change_mtu = NULL; |
331 | retval = rndis_command(dev, u.header); | 331 | retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE); |
332 | if (unlikely(retval < 0)) { | 332 | if (unlikely(retval < 0)) { |
333 | /* it might not even be an RNDIS device!! */ | 333 | /* it might not even be an RNDIS device!! */ |
334 | dev_err(&intf->dev, "RNDIS init failed, %d\n", retval); | 334 | dev_err(&intf->dev, "RNDIS init failed, %d\n", retval); |
@@ -409,7 +409,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
409 | u.set->offset = ccpu2((sizeof *u.set) - 8); | 409 | u.set->offset = ccpu2((sizeof *u.set) - 8); |
410 | *(__le32 *)(u.buf + sizeof *u.set) = RNDIS_DEFAULT_FILTER; | 410 | *(__le32 *)(u.buf + sizeof *u.set) = RNDIS_DEFAULT_FILTER; |
411 | 411 | ||
412 | retval = rndis_command(dev, u.header); | 412 | retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE); |
413 | if (unlikely(retval < 0)) { | 413 | if (unlikely(retval < 0)) { |
414 | dev_err(&intf->dev, "rndis set packet filter, %d\n", retval); | 414 | dev_err(&intf->dev, "rndis set packet filter, %d\n", retval); |
415 | goto halt_fail_and_release; | 415 | goto halt_fail_and_release; |
@@ -424,7 +424,7 @@ halt_fail_and_release: | |||
424 | memset(u.halt, 0, sizeof *u.halt); | 424 | memset(u.halt, 0, sizeof *u.halt); |
425 | u.halt->msg_type = RNDIS_MSG_HALT; | 425 | u.halt->msg_type = RNDIS_MSG_HALT; |
426 | u.halt->msg_len = ccpu2(sizeof *u.halt); | 426 | u.halt->msg_len = ccpu2(sizeof *u.halt); |
427 | (void) rndis_command(dev, (void *)u.halt); | 427 | (void) rndis_command(dev, (void *)u.halt, CONTROL_BUFFER_SIZE); |
428 | fail_and_release: | 428 | fail_and_release: |
429 | usb_set_intfdata(info->data, NULL); | 429 | usb_set_intfdata(info->data, NULL); |
430 | usb_driver_release_interface(driver_of(intf), info->data); | 430 | usb_driver_release_interface(driver_of(intf), info->data); |
@@ -449,7 +449,7 @@ void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
449 | if (halt) { | 449 | if (halt) { |
450 | halt->msg_type = RNDIS_MSG_HALT; | 450 | halt->msg_type = RNDIS_MSG_HALT; |
451 | halt->msg_len = ccpu2(sizeof *halt); | 451 | halt->msg_len = ccpu2(sizeof *halt); |
452 | (void) rndis_command(dev, (void *)halt); | 452 | (void) rndis_command(dev, (void *)halt, CONTROL_BUFFER_SIZE); |
453 | kfree(halt); | 453 | kfree(halt); |
454 | } | 454 | } |
455 | 455 | ||
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index a36d2c85e26e..f001f2afd05e 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -448,7 +448,7 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len) | |||
448 | u.get->msg_len = ccpu2(sizeof *u.get); | 448 | u.get->msg_len = ccpu2(sizeof *u.get); |
449 | u.get->oid = oid; | 449 | u.get->oid = oid; |
450 | 450 | ||
451 | ret = rndis_command(dev, u.header); | 451 | ret = rndis_command(dev, u.header, buflen); |
452 | if (ret == 0) { | 452 | if (ret == 0) { |
453 | ret = le32_to_cpu(u.get_c->len); | 453 | ret = le32_to_cpu(u.get_c->len); |
454 | *len = (*len > ret) ? ret : *len; | 454 | *len = (*len > ret) ? ret : *len; |
@@ -498,7 +498,7 @@ static int rndis_set_oid(struct usbnet *dev, __le32 oid, void *data, int len) | |||
498 | u.set->handle = ccpu2(0); | 498 | u.set->handle = ccpu2(0); |
499 | memcpy(u.buf + sizeof(*u.set), data, len); | 499 | memcpy(u.buf + sizeof(*u.set), data, len); |
500 | 500 | ||
501 | ret = rndis_command(dev, u.header); | 501 | ret = rndis_command(dev, u.header, buflen); |
502 | if (ret == 0) | 502 | if (ret == 0) |
503 | ret = rndis_error_status(u.set_c->status); | 503 | ret = rndis_error_status(u.set_c->status); |
504 | 504 | ||
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h index 29d6458ecb8d..0a6e6d4b929a 100644 --- a/include/linux/usb/rndis_host.h +++ b/include/linux/usb/rndis_host.h | |||
@@ -260,7 +260,8 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */ | |||
260 | 260 | ||
261 | 261 | ||
262 | extern void rndis_status(struct usbnet *dev, struct urb *urb); | 262 | extern void rndis_status(struct usbnet *dev, struct urb *urb); |
263 | extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf); | 263 | extern int |
264 | rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen); | ||
264 | extern int | 265 | extern int |
265 | generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags); | 266 | generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags); |
266 | extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf); | 267 | extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf); |