Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb - Fix panic on shutdown reported by ozaki-r in P...



details:   https://anonhg.NetBSD.org/src/rev/1467b019e69f
branches:  trunk
changeset: 829450:1467b019e69f
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Feb 01 09:47:47 2018 +0000

description:
- Fix panic on shutdown reported by ozaki-r in PR kern/52961. Use callot_halt()
  correctly. Tested by me and OK'd by Nick.
- Disable interrupt in och_shutdown() to prevent hangup. OK'd by Nick.

diffstat:

 sys/dev/usb/ohci.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r 020205a0d504 -r 1467b019e69f sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Thu Feb 01 09:09:14 2018 +0000
+++ b/sys/dev/usb/ohci.c        Thu Feb 01 09:47:47 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.276 2017/11/17 08:22:02 skrll Exp $ */
+/*     $NetBSD: ohci.c,v 1.277 2018/02/01 09:47:47 msaitoh Exp $       */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.276 2017/11/17 08:22:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.277 2018/02/01 09:47:47 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -377,13 +377,11 @@
        if (rv != 0)
                return rv;
 
-       callout_halt(&sc->sc_tmo_rhsc, &sc->sc_lock);
-
-       usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
+       softint_disestablish(sc->sc_rhsc_si);
+
+       callout_halt(&sc->sc_tmo_rhsc, NULL);
        callout_destroy(&sc->sc_tmo_rhsc);
 
-       softint_disestablish(sc->sc_rhsc_si);
-
        cv_destroy(&sc->sc_softwake_cv);
 
        mutex_destroy(&sc->sc_lock);
@@ -1111,6 +1109,7 @@
        OHCIHIST_FUNC(); OHCIHIST_CALLED();
 
        DPRINTF("stopping the HC", 0, 0, 0, 0);
+       OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
        OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
        return true;
 }



Home | Main Index | Thread Index | Old Index