summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/ugen.c5
-rw-r--r--sys/dev/usb/usb.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 1fd5dda6543..a5ab171b344 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ugen.c,v 1.71 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: ugen.c,v 1.72 2013/05/17 09:09:11 mpi Exp $ */
/* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */
/* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -1202,6 +1202,9 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
error = EIO;
goto ret;
}
+ /* Only if USBD_SHORT_XFER_OK is set. */
+ if (len > ur->ucr_actlen)
+ len = ur->ucr_actlen;
if (len != 0) {
if (uio.uio_rw == UIO_READ) {
error = uiomove(ptr, len, &uio);
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 2ed661666d7..2054f207820 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.90 2013/04/26 14:05:24 mpi Exp $ */
+/* $OpenBSD: usb.c,v 1.91 2013/05/17 09:09:11 mpi Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -622,6 +622,9 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p)
error = EIO;
goto ret;
}
+ /* Only if USBD_SHORT_XFER_OK is set. */
+ if (len > ur->ucr_actlen)
+ len = ur->ucr_actlen;
if (len != 0) {
if (uio.uio_rw == UIO_READ) {
error = uiomove(ptr, len, &uio);