diff options
| author | manu <manu@NetBSD.org> | 2018-11-08 01:59:53 +0000 |
|---|---|---|
| committer | manu <manu@NetBSD.org> | 2018-11-08 01:59:53 +0000 |
| commit | cdfeaa356d758f80dd4d2d5fef6bcda83bd0a45b (patch) | |
| tree | 9675ac2d3cd0590ccfae739db77eaa53cca28c68 /sys | |
| parent | 3ea0107c941e4c4d5e55b983555dc2f6d8067bfa (diff) | |
Enfore USB timeout on ugen(4) write operations
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/usb/ugen.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index a97e9b3b690..790ceb25313 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -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 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, 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 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, 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) |
