diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-08-13 09:26:06 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-08-13 09:26:06 +0000 |
commit | 9b7a0253db3a9a9a71bbc1df9e964078b5a11f3c (patch) | |
tree | 34f77d922dd58885bb08a5d6139883c8bfae0257 /sys/dev/usb/usbdi.c | |
parent | 4a9d7b8cffde8318b25d86fdcfb35ae0c87f0332 (diff) |
Remove bogus and useless refcounting of usbd pipes that could lead to
memory leaks and abort the pipe if requests are still pending because
most of our drivers don't do anything if usbd_close_pipe() fails.
ok miod@
Diffstat (limited to 'sys/dev/usb/usbdi.c')
-rw-r--r-- | sys/dev/usb/usbdi.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index c9db98f697d..ba7477eb7d7 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.56 2013/08/08 09:37:02 mpi Exp $ */ +/* $OpenBSD: usbdi.c,v 1.57 2013/08/13 09:26:04 mpi Exp $ */ /* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -273,10 +273,9 @@ usbd_close_pipe(struct usbd_pipe *pipe) } #endif - if (--pipe->refcnt != 0) - return (USBD_NORMAL_COMPLETION); - if (! SIMPLEQ_EMPTY(&pipe->queue)) - return (USBD_PENDING_REQUESTS); + if (!SIMPLEQ_EMPTY(&pipe->queue)) + usbd_abort_pipe(pipe); + /* Default pipes are never linked */ if (pipe->iface != NULL) LIST_REMOVE(pipe, next); |