diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2009-02-21 08:18:14 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2009-02-21 08:18:14 +0000 |
commit | 7b3533dbf0b9ef3a0cf584a0847b89fce3bcad08 (patch) | |
tree | 3d39907c3f351e4382f1d4794e09afd71ff1d792 /sys/dev/usb | |
parent | 3cc3aa17fc686e41a4851ccb92918bdd1119d83c (diff) |
Fix a kernel crash for bulk devices when closing the video stream;
We give the kthread loop a moment to recognize that bulk_running=0
before we close the USB pipes. Otherwise it can happen that we close
the USB pipes before the kthread loop stopped.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/uvideo.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index da18a50645e..0f74138b112 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.119 2009/02/20 08:34:48 mglocker Exp $ */ +/* $OpenBSD: uvideo.c,v 1.120 2009/02/21 08:18:13 mglocker Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> @@ -1674,12 +1674,6 @@ uvideo_vs_close(struct uvideo_softc *sc) { sc->sc_vs_cur->bulk_running = 0; - if (sc->sc_vs_cur->pipeh) { - usbd_abort_pipe(sc->sc_vs_cur->pipeh); - usbd_close_pipe(sc->sc_vs_cur->pipeh); - sc->sc_vs_cur->pipeh = NULL; - } - /* * Some devices need time to shutdown before we switch back to * the default interface (0). Not doing so can leave the device @@ -1687,6 +1681,12 @@ uvideo_vs_close(struct uvideo_softc *sc) */ usbd_delay_ms(sc->sc_udev, 100); + if (sc->sc_vs_cur->pipeh) { + usbd_abort_pipe(sc->sc_vs_cur->pipeh); + usbd_close_pipe(sc->sc_vs_cur->pipeh); + sc->sc_vs_cur->pipeh = NULL; + } + /* switch back to default interface (turns off cam LED) */ (void)usbd_set_interface(sc->sc_vs_cur->ifaceh, 0); } |