diff options
author | andre <andre@cvs.openbsd.org> | 2014-03-23 12:20:15 +0000 |
---|---|---|
committer | andre <andre@cvs.openbsd.org> | 2014-03-23 12:20:15 +0000 |
commit | f9fe73646151de9350d39edf9cbe8e86926a7e76 (patch) | |
tree | add14f203ad3f8bdb1d8d4a65beaf8ffd27c6af5 | |
parent | 79d065a954940141014d894e5af25a7133be52c1 (diff) |
Fix uhidev_detach() when detaching a device which did not claimed for all
report IDs, on those cases some positions on sc_subdevs[] can be null.
Initial analysis by guenther@.
ok mpi@
-rw-r--r-- | sys/dev/usb/uhidev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 4323335fe68..af9bec6696e 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.56 2014/03/19 08:59:37 mpi Exp $ */ +/* $OpenBSD: uhidev.c,v 1.57 2014/03/23 12:20:14 andre Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -387,7 +387,8 @@ uhidev_detach(struct device *self, int flags) * IDs, this is a hack since we need a dev -> Report ID mapping * for uhidev_intr(). */ - if (sc->sc_nrepid > 0 && sc->sc_subdevs[0] == sc->sc_subdevs[1]) + if (sc->sc_nrepid > 1 && sc->sc_subdevs[0] != NULL && + sc->sc_subdevs[0] == sc->sc_subdevs[1]) return (config_detach(&sc->sc_subdevs[0]->sc_dev, flags)); for (i = 0; i < sc->sc_nrepid; i++) { |