aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/urb.c8
-rw-r--r--include/linux/usb.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 16927fa88fbd..e75115a04a2e 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -7,6 +7,7 @@
7#include <linux/usb.h> 7#include <linux/usb.h>
8#include <linux/wait.h> 8#include <linux/wait.h>
9#include <linux/usb/hcd.h> 9#include <linux/usb/hcd.h>
10#include <linux/scatterlist.h>
10 11
11#define to_urb(d) container_of(d, struct urb, kref) 12#define to_urb(d) container_of(d, struct urb, kref)
12 13
@@ -413,6 +414,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
413 urb->iso_frame_desc[n].status = -EXDEV; 414 urb->iso_frame_desc[n].status = -EXDEV;
414 urb->iso_frame_desc[n].actual_length = 0; 415 urb->iso_frame_desc[n].actual_length = 0;
415 } 416 }
417 } else if (dev->speed != USB_SPEED_WIRELESS && urb->num_sgs) {
418 struct scatterlist *sg;
419 int i;
420
421 for_each_sg(urb->sg, sg, urb->num_sgs - 1, i)
422 if (sg->length % max)
423 return -EINVAL;
416 } 424 }
417 425
418 /* the I/O buffer must be mapped/unmapped, except when length=0 */ 426 /* the I/O buffer must be mapped/unmapped, except when length=0 */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a232b7ece1f6..e99b2a114af4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1258,7 +1258,9 @@ typedef void (*usb_complete_t)(struct urb *);
1258 * the device driver is saying that it provided this DMA address, 1258 * the device driver is saying that it provided this DMA address,
1259 * which the host controller driver should use in preference to the 1259 * which the host controller driver should use in preference to the
1260 * transfer_buffer. 1260 * transfer_buffer.
1261 * @sg: scatter gather buffer list 1261 * @sg: scatter gather buffer list, the buffer size of each element in
1262 * the list (except the last) must be divisible by the endpoint's
1263 * max packet size
1262 * @num_mapped_sgs: (internal) number of mapped sg entries 1264 * @num_mapped_sgs: (internal) number of mapped sg entries
1263 * @num_sgs: number of entries in the sg list 1265 * @num_sgs: number of entries in the sg list
1264 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1266 * @transfer_buffer_length: How big is transfer_buffer. The transfer may