Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb In uhub_childdet, do not free the array of sub-d...



details:   https://anonhg.NetBSD.org/src/rev/d57b91acf04e
branches:  trunk
changeset: 781488:d57b91acf04e
user:      gsutre <gsutre%NetBSD.org@localhost>
date:      Sun Sep 09 20:23:38 2012 +0000

description:
In uhub_childdet, do not free the array of sub-devices if there is none.
This prevents a kernel panic at shutdown on my laptop.

diffstat:

 sys/dev/usb/uhub.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 898c5d2d4429 -r d57b91acf04e sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c        Sun Sep 09 18:09:24 2012 +0000
+++ b/sys/dev/usb/uhub.c        Sun Sep 09 20:23:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhub.c,v 1.117 2012/03/12 02:44:17 mrg Exp $   */
+/*     $NetBSD: uhub.c,v 1.118 2012/09/09 20:23:38 gsutre Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $       */
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.117 2012/03/12 02:44:17 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.118 2012/09/09 20:23:38 gsutre Exp $");
 
 #include "opt_usb.h"
 
@@ -671,7 +671,7 @@
        nports = devhub->hub->hubdesc.bNbrPorts;
        for (port = 0; port < nports; port++) {
                dev = devhub->hub->ports[port].device;
-               if (!dev)
+               if (!dev || dev->subdevlen == 0)
                        continue;
                for (i = 0; i < dev->subdevlen; i++) {
                        if (dev->subdevs[i] == child) {



Home | Main Index | Thread Index | Old Index