Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Take sc_rsw_mtx before calling wpi_getrfkill() f...



details:   https://anonhg.NetBSD.org/src/rev/71c8072f0427
branches:  trunk
changeset: 805633:71c8072f0427
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Jan 09 15:25:23 2015 +0000

description:
Take sc_rsw_mtx before calling wpi_getrfkill() from wpi_init(),
Problem reported and patch tested by chris at chriswareham.net

diffstat:

 sys/dev/pci/if_wpi.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r d62d634cedf4 -r 71c8072f0427 sys/dev/pci/if_wpi.c
--- a/sys/dev/pci/if_wpi.c      Fri Jan 09 12:45:32 2015 +0000
+++ b/sys/dev/pci/if_wpi.c      Fri Jan 09 15:25:23 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wpi.c,v 1.70 2015/01/06 15:39:54 bouyer Exp $       */
+/*     $NetBSD: if_wpi.c,v 1.71 2015/01/09 15:25:23 bouyer Exp $       */
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.70 2015/01/06 15:39:54 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.71 2015/01/09 15:25:23 bouyer Exp $");
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -3197,13 +3197,16 @@
                goto fail1;
 
        /* Check the status of the radio switch */
+       mutex_enter(&sc->sc_rsw_mtx);
        if (wpi_getrfkill(sc)) {
+               mutex_exit(&sc->sc_rsw_mtx);
                aprint_error_dev(sc->sc_dev,
                    "radio is disabled by hardware switch\n");
                ifp->if_flags &= ~IFF_UP;
                error = EBUSY;
                goto fail1;
        }
+       mutex_exit(&sc->sc_rsw_mtx);
 
        /* wait for thermal sensors to calibrate */
        for (ntries = 0; ntries < 1000; ntries++) {



Home | Main Index | Thread Index | Old Index