PERFORCE change 39549 for review

Sam Leffler sam at FreeBSD.org
Sat Oct 11 23:08:01 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=39549

Change 39549 by sam at 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;


More information about the p4-projects mailing list