⬢ DragonFlyBSD Kernel Audit
DF-5009 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/mii_layer/rlphy.c
+++ b/sys/dev/netif/mii_layer/rlphy.c
@@ -195,10 +195,16 @@
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
 
 	/*
-	 * We can't isolate the RealTek PHY, so it has to be the only one!
+	 * We can't isolate the RealTek PHY.  If some other PHY's media is
+	 * selected, leave ours alone: the miibus dispatch (mii_mediachg,
+	 * mii_tick, mii_pollstat) invokes every PHY's service routine with
+	 * the *shared* ifm_cur, so on a multi-PHY bus the currently
+	 * selected media legitimately belongs to a sibling instance.
+	 *
+	 * Same guard shape as ukphy_service()/xmphy_service().
 	 */
-	KASSERT(IFM_INST(ife->ifm_media) == sc->mii_inst,
-		("rlphy_service: can't isolate RealTek PHY"));
+	if (IFM_INST(ife->ifm_media) != sc->mii_inst)
+		return (0);
 
 	switch (cmd) {
 	case MII_POLLSTAT: