u4b - Fix panic on certain cell phone connections master
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 22 Aug 2014 21:59:46 +0000 (14:59 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 22 Aug 2014 21:59:46 +0000 (14:59 -0700)
* Remove incorrect unlock in ucom_close().

* Add missing usb_callout_stop() to umass_cam_detach_sim(), fixes issue with umass
  if the mass-storage device quickly connects and disconnects from the bus.

Reported-by: Rolinh
sys/bus/u4b/serial/usb_serial.c
sys/bus/u4b/storage/umass.c

index 6fdc213..98bde3c 100644 (file)
@@ -863,7 +863,6 @@ ucom_close(struct ucom_softc *sc)
 
        if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) {
                DPRINTF("tp=%p already closed\n", tp);
-               UCOM_MTX_UNLOCK(sc);
                return (error);
        }
        ucom_shutdown(sc);
index 1b0293c..8d39f7f 100644 (file)
@@ -2087,7 +2087,6 @@ umass_cam_attach_sim(struct umass_softc *sc)
         * The CAM layer will then after a while start probing for devices on
         * the bus. The number of SIMs is limited to one.
         */
-       usb_callout_init_mtx(&sc->sc_rescan_timeout, &sc->sc_lock, 0);
 
        devq = cam_simq_alloc(1 /* maximum openings */ );
        if (devq == NULL) {
@@ -2109,6 +2108,7 @@ umass_cam_attach_sim(struct umass_softc *sc)
        if (sc->sc_sim == NULL) {
                return (ENOMEM);
        }
+       usb_callout_init_mtx(&sc->sc_rescan_timeout, &sc->sc_lock, 0);
 
        lockmgr(&sc->sc_lock, LK_EXCLUSIVE);
 
@@ -2204,6 +2204,7 @@ static void
 umass_cam_detach_sim(struct umass_softc *sc)
 {
        if (sc->sc_sim != NULL) {
+               usb_callout_stop(&sc->sc_rescan_timeout);
                if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) {
                        /* accessing the softc is not possible after this */
                        sc->sc_sim->softc = NULL;