summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-12-04 08:17:40 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-12-04 08:17:40 +0000
commitcf17c928ebba7f2d9cbe85ae777397c2a4ed7c82 (patch)
tree8b9c92bd9daa42c0495033e0d6372c3e4d59735c /sys/dev/usb
parentb1beaf3d04843307cc40f879927eaf88eab8d79c (diff)
In uaudio_detach(), check that sc->sc_alts is not NULL before
using it. This could happen if uaudio_attach() failed, for instance because the device has no valid audio stream interface. Certain MIDI devices expose such descriptors. ok jakemsr@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uaudio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index e818abb1047..fba633e7c8f 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.70 2009/11/26 15:45:25 jakemsr Exp $ */
+/* $OpenBSD: uaudio.c,v 1.71 2009/12/04 08:17:39 ratchov Exp $ */
/* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */
/*
@@ -491,6 +491,12 @@ uaudio_detach(struct device *self, int flags)
struct chan *rchan = &sc->sc_recchan;
int ms, rv = 0;
+ /*
+ * sc_alts may be NULL if uaudio_identify_as() failed
+ */
+ if (sc->sc_alts == NULL)
+ return rv;
+
/* Wait for outstanding requests to complete. */
ms = max(sc->sc_alts[pchan->altidx].sc_busy ? pchan->reqms : 0,
sc->sc_alts[rchan->altidx].sc_busy ? rchan->reqms : 0);