diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-11-19 18:42:28 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-11-19 18:42:28 +0000 |
commit | 72c198ecbd6d80130fa45ce3db82d546029dcac9 (patch) | |
tree | 62a3e6d37dbc1b7793bb5c34f3bb698e34d37caf /sys/dev/usb/uhci.c | |
parent | 0ae08084bdeee734850317c2723d814a0ac8bad1 (diff) |
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@
Diffstat (limited to 'sys/dev/usb/uhci.c')
-rw-r--r-- | sys/dev/usb/uhci.c | 6 |
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 |