diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2008-05-16 08:01:40 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2008-05-16 08:01:40 +0000 |
commit | e7ce8a44a0f58f7c0e64e0141a76160ff8b28b78 (patch) | |
tree | 688dc53f5878e7a9c1c216592eb51cf60ae51932 /sys/dev | |
parent | 5371a5f03e24dcd6745bb5d04d9d3e9e053967e5 (diff) |
Fix kernel crash when device gets detached.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/uvideo.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index ac1e5ea75a6..35a2d07eee7 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.12 2008/05/15 07:50:41 mglocker Exp $ */ +/* $OpenBSD: uvideo.c,v 1.13 2008/05/16 08:01:39 mglocker Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> @@ -305,7 +305,8 @@ uvideo_detach(struct device * self, int flags) struct uvideo_softc *sc = (struct uvideo_softc *)self; int rv = 0; - sc->sc_dying = 1; + /* Wait for outstanding requests to complete */ + usbd_delay_ms(sc->sc_udev, UVIDEO_NFRAMES_MAX); if (sc->sc_videodev != NULL) rv = config_detach(sc->sc_videodev, flags); @@ -981,6 +982,9 @@ uvideo_vs_start(struct uvideo_softc *sc) DPRINTF(2, "%s: %s\n", DEVNAME(sc), __func__); + if (sc->sc_dying) + return; + for (i = 0; i < sc->sc_nframes; i++) sc->sc_vs_curr->size[i] = sc->sc_vs_curr->max_packet_size; |