summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2005-09-09 12:04:30 +0000
committerdrochner <drochner@NetBSD.org>2005-09-09 12:04:30 +0000
commitfd6c232a7aadc155ef373acb2491c9cb86d23a4e (patch)
tree1fa09a51011cb1545b28a01880819211068cfc29 /sys/dev/usb
parentaada101c5e513e523fbb90a773682aec57454af9 (diff)
Allow a NULL pointer as argument to usb_get_next_event(), and don't
allocate a "struct usb_event" on stack in usb_add_event(). This gives just enough breathing space that the box doesn't die immediately from stack overflow when I insert a ohci0 at cardbus0 dev 0 function 0: Acer Labs M5237 USB 1.1 Host Controller
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/usb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 95a50595d6f..c05095b37ff 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.82 2005/06/21 14:01:12 ws Exp $ */
+/* $NetBSD: usb.c,v 1.83 2005/09/09 12:04:30 drochner Exp $ */
/*
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.82 2005/06/21 14:01:12 ws Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.83 2005/09/09 12:04:30 drochner Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -703,7 +703,8 @@ usb_get_next_event(struct usb_event *ue)
return (0);
}
#endif
- *ue = ueq->ue;
+ if (ue)
+ *ue = ueq->ue;
SIMPLEQ_REMOVE_HEAD(&usb_events, next);
free(ueq, M_USBDEV);
usb_nevents--;
@@ -734,7 +735,6 @@ Static void
usb_add_event(int type, struct usb_event *uep)
{
struct usb_event_q *ueq;
- struct usb_event ue;
struct timeval thetime;
int s;
@@ -749,7 +749,7 @@ usb_add_event(int type, struct usb_event *uep)
if (++usb_nevents >= USB_MAX_EVENTS) {
/* Too many queued events, drop an old one. */
DPRINTFN(-1,("usb: event dropped\n"));
- (void)usb_get_next_event(&ue);
+ (void)usb_get_next_event(0);
}
SIMPLEQ_INSERT_TAIL(&usb_events, ueq, next);
wakeup(&usb_events);