Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Don't crash during detach if the attach hook fai...



details:   https://anonhg.NetBSD.org/src/rev/4ccf4fbe5758
branches:  trunk
changeset: 759227:4ccf4fbe5758
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Dec 02 16:56:21 2010 +0000

description:
Don't crash during detach if the attach hook failed before setting up.
>From Chuck Silvers

diffstat:

 sys/dev/usb/if_otus.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 21624c177350 -r 4ccf4fbe5758 sys/dev/usb/if_otus.c
--- a/sys/dev/usb/if_otus.c     Thu Dec 02 16:46:22 2010 +0000
+++ b/sys/dev/usb/if_otus.c     Thu Dec 02 16:56:21 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_otus.c,v 1.7 2010/11/04 14:08:31 christos Exp $     */
+/*     $NetBSD: if_otus.c,v 1.8 2010/12/02 16:56:21 christos Exp $     */
 /*     $OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $        */
 
 /*-
@@ -645,6 +645,9 @@
 
        DPRINTF("otus_detach\n");
 
+       if (ifp == NULL)        /* Failed to attach properly */
+               return 0;
+
        otus_stop(ifp);
 
        s = splnet();



Home | Main Index | Thread Index | Old Index