summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2010-11-19 18:42:27 +0000
committermiod <miod@openbsd.org>2010-11-19 18:42:27 +0000
commit60a90fe01c6ac3562443c76e0bab8c5fefef1191 (patch)
tree10a1b11a0f2373d63d07af3b05c0f7144ff3820b
parentMake KERN_CPTIME return an avarage number of ticks across all CPUs (diff)
downloadwireguard-openbsd-60a90fe01c6ac3562443c76e0bab8c5fefef1191.tar.xz
wireguard-openbsd-60a90fe01c6ac3562443c76e0bab8c5fefef1191.zip
Do not allow malloc() to wait in uhci_device_setintr(), instead check for
failure and return USBD_NOMEM, callers will do TRT. ok jakemser@ deraadt@ kettenis@ tedu@
-rw-r--r--sys/dev/usb/uhci.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 193bd8de910..c2b64ae79d9 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.84 2010/10/23 15:42:09 jakemsr Exp $ */
+/* $OpenBSD: uhci.c,v 1.85 2010/11/19 18:42:27 miod Exp $ */
/* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -2757,7 +2757,9 @@ uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival)
upipe->u.intr.npoll = npoll;
upipe->u.intr.qhs =
- malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_WAITOK);
+ malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_NOWAIT);
+ if (upipe->u.intr.qhs == NULL)
+ return (USBD_NOMEM);
/*
* Figure out which offset in the schedule that has most