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 | |
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')
-rw-r--r-- | sys/dev/usb/usb_subr.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/usbdivar.h | 3 |
3 files changed, 6 insertions, 9 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 8217a8ad090..2420cea7896 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.91 2013/08/08 09:44:22 mpi Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.92 2013/08/13 09:26:04 mpi Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -803,7 +803,6 @@ usbd_setup_pipe(struct usbd_device *dev, struct usbd_interface *iface, p->iface = iface; p->endpoint = ep; ep->refcnt++; - p->refcnt = 1; p->intrxfer = 0; p->running = 0; p->aborting = 0; 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); diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index 0d6582e7a88..e8e739abd68 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdivar.h,v 1.50 2013/08/08 09:44:22 mpi Exp $ */ +/* $OpenBSD: usbdivar.h,v 1.51 2013/08/13 09:26:05 mpi Exp $ */ /* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ @@ -159,7 +159,6 @@ struct usbd_pipe { struct usbd_interface *iface; struct usbd_device *device; struct usbd_endpoint *endpoint; - int refcnt; char running; char aborting; SIMPLEQ_HEAD(, usbd_xfer) queue; |