From owner-p4-projects@FreeBSD.ORG Sat Oct 11 23:08:01 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D5E9816A4C0; Sat, 11 Oct 2003 23:08:00 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD02A16A4B3 for ; Sat, 11 Oct 2003 23:08:00 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF36243FD7 for ; Sat, 11 Oct 2003 23:07:58 -0700 (PDT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9C67wXJ082048 for ; Sat, 11 Oct 2003 23:07:58 -0700 (PDT) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9C67wH6082045 for perforce@freebsd.org; Sat, 11 Oct 2003 23:07:58 -0700 (PDT) (envelope-from sam@freebsd.org) Date: Sat, 11 Oct 2003 23:07:58 -0700 (PDT) Message-Id: <200310120607.h9C67wH6082045@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 39549 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2003 06:08:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=39549 Change 39549 by sam@sam_ebb on 2003/10/11 23:07:06 o don't grab the mutex at the top of ath_detach; it does nothing useful o deal with entry to ath_ioctl during detach to disable promiscuous mode as a result of calling bpfdetach2: cannot call ath_init when the device is marked invalid as the code isn't prepared to deal with it (in particular by that time the hal reference may have been yanked) Affected files ... .. //depot/projects/netperf/sys/dev/ath/if_ath.c#16 edit Differences ... ==== //depot/projects/netperf/sys/dev/ath/if_ath.c#16 (text+ko) ==== @@ -330,7 +330,6 @@ DPRINTF(("ath_detach: if_flags %x\n", ifp->if_flags)); - mtx_lock(&sc->sc_mtx); ath_stop(ifp); bpfdetach(ifp); ath_desc_free(sc); @@ -851,8 +850,19 @@ * only reflect promisc mode settings. */ ath_mode_init(sc); - } else - ath_init(ifp); /* XXX lose error */ + } else { + /* + * Beware of being called during detach to + * reset promiscuous mode. In that case we + * will still be marked UP but not RUNNING. + * However trying to re-init the interface + * is the wrong thing to do as we've already + * torn down much of our state. There's + * probably a better way to deal with this. + */ + if (!sc->sc_invalid) + ath_init(ifp); /* XXX lose error */ + } } else ath_stop(ifp); break;