From 35471a0b16547998da9b08ad8457ab8e6a5a6bfc Mon Sep 17 00:00:00 2001 From: ians Date: Fri, 21 Jul 2017 20:13:42 +0000 Subject: Do not permit USB ioctl handler malloc(9)'s to block as this interferes with expected behavior. OK mpi@ patrick@ --- sys/dev/usb/usb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sys/dev/usb/usb.c') diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 21e4371c19c..1d9954e74ab 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.112 2017/04/08 02:57:25 deraadt Exp $ */ +/* $OpenBSD: usb.c,v 1.113 2017/07/21 20:13:41 ians Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -649,7 +649,10 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; - ptr = malloc(len, M_TEMP, M_WAITOK); + if ((ptr = malloc(len, M_TEMP, M_NOWAIT)) == NULL) { + error = ENOMEM; + goto ret; + } if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) -- cgit v1.2.3