Module Name: src
Committed By: jakllsch
Date: Fri Nov 25 02:59:55 UTC 2011
Modified Files:
src/sys/dev/usb: ugen.c
Log Message:
Prevent poll and kqueue on the control endpoint.
Addresses PR#33352.
(The control endpoint doesn't support pipes, so this would be of dubious
usefulness even if it didn't expose bugs.)
To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/usb/ugen.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.112 src/sys/dev/usb/ugen.c:1.113
--- src/sys/dev/usb/ugen.c:1.112 Sun Nov 20 22:27:39 2011
+++ src/sys/dev/usb/ugen.c Fri Nov 25 02:59:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.112 2011/11/20 22:27:39 gavan Exp $ */
+/* $NetBSD: ugen.c,v 1.113 2011/11/25 02:59:54 jakllsch 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.112 2011/11/20 22:27:39 gavan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.113 2011/11/25 02:59:54 jakllsch Exp $");
#include "opt_compat_netbsd.h"
@@ -1866,6 +1866,9 @@ ugenpoll(dev_t dev, int events, struct l
if (sc->sc_dying)
return (POLLHUP);
+ if (UGENENDPOINT(dev) == USB_CONTROL_ENDPOINT)
+ return ENODEV;
+
sce_in = &sc->sc_endpoints[UGENENDPOINT(dev)][IN];
sce_out = &sc->sc_endpoints[UGENENDPOINT(dev)][OUT];
if (sce_in == NULL && sce_out == NULL)
@@ -2053,6 +2056,9 @@ ugenkqfilter(dev_t dev, struct knote *kn
if (sc->sc_dying)
return (ENXIO);
+ if (UGENENDPOINT(dev) == USB_CONTROL_ENDPOINT)
+ return ENODEV;
+
switch (kn->kn_filter) {
case EVFILT_READ:
sce = &sc->sc_endpoints[UGENENDPOINT(dev)][IN];