Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Enfore USB timeout on ugen(4) write operations



details:   https://anonhg.NetBSD.org/src/rev/fb10b498c6cb
branches:  trunk
changeset: 445651:fb10b498c6cb
user:      manu <manu%NetBSD.org@localhost>
date:      Thu Nov 08 01:59:53 2018 +0000

description:
Enfore USB timeout on ugen(4) write operations

diffstat:

 sys/dev/usb/ugen.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (48 lines):

diff -r e9e38c32e770 -r fb10b498c6cb sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Wed Nov 07 22:51:47 2018 +0000
+++ b/sys/dev/usb/ugen.c        Thu Nov 08 01:59:53 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.140 2018/09/03 16:29:34 riastradh Exp $     */
+/*     $NetBSD: ugen.c,v 1.141 2018/11/08 01:59:53 manu Exp $  */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.140 2018/09/03 16:29:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.141 2018/11/08 01:59:53 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1456,6 +1456,7 @@
        uint8_t conf, alt;
        int cdesclen;
        int error;
+       int dir;
 
        DPRINTFN(5, ("ugenioctl: cmd=%08lx\n", cmd));
        if (sc->sc_dying)
@@ -1478,14 +1479,13 @@
                        sce->state &= ~UGEN_SHORT_OK;
                return 0;
        case USB_SET_TIMEOUT:
-               sce = &sc->sc_endpoints[endpt][IN];
-               if (sce == NULL
-                   /* XXX this shouldn't happen, but the distinction between
-                      input and output pipes isn't clear enough.
-                      || sce->pipeh == NULL */
-                       )
-                       return EINVAL;
-               sce->timeout = *(int *)addr;
+               for (dir = OUT; dir <= IN; dir++) {
+                       sce = &sc->sc_endpoints[endpt][dir];
+                       if (sce == NULL)
+                               return EINVAL;
+
+                       sce->timeout = *(int *)addr;
+               }
                return 0;
        case USB_SET_BULK_RA:
                if (endpt == USB_CONTROL_ENDPOINT)



Home | Main Index | Thread Index | Old Index