summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2006-09-27 14:40:56 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2006-09-27 14:40:56 +0000
commit74dea994e73cd4c0390de608e75ae015f354d820 (patch)
treeededdbeb8ca06a622b76f4830108d93148ce9997 /sys
parent27df79a3bb55ddf927c7d170e13484a61a4c83e9 (diff)
Protect detach function with splusb.
Call usbd_abort_pipe before closing pipe.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/uow.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/dev/usb/uow.c b/sys/dev/usb/uow.c
index 9b3fce3df0c..e18f53b8d70 100644
--- a/sys/dev/usb/uow.c
+++ b/sys/dev/usb/uow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uow.c,v 1.2 2006/09/27 13:02:47 grange Exp $ */
+/* $OpenBSD: uow.c,v 1.3 2006/09/27 14:40:55 grange Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -191,18 +191,28 @@ fail:
USB_DETACH(uow)
{
USB_DETACH_START(uow, sc);
- int rv = 0;
+ int rv = 0, s;
- if (sc->sc_ph_ibulk != NULL)
+ s = splusb();
+
+ if (sc->sc_ph_ibulk != NULL) {
+ usbd_abort_pipe(sc->sc_ph_ibulk);
usbd_close_pipe(sc->sc_ph_ibulk);
- if (sc->sc_ph_obulk != NULL)
+ }
+ if (sc->sc_ph_obulk != NULL) {
+ usbd_abort_pipe(sc->sc_ph_obulk);
usbd_close_pipe(sc->sc_ph_obulk);
- if (sc->sc_ph_intr != NULL)
+ }
+ if (sc->sc_ph_intr != NULL) {
+ usbd_abort_pipe(sc->sc_ph_intr);
usbd_close_pipe(sc->sc_ph_intr);
+ }
if (sc->sc_ow_dev != NULL)
rv = config_detach(sc->sc_ow_dev, flags);
+ splx(s);
+
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
USBDEV(sc->sc_dev));