Path: blob/main/website/static/security/patches/EN-13:01/fxp_init.patch
18096 views
Index: sys/dev/fxp/if_fxp.c1===================================================================2--- sys/dev/fxp/if_fxp.c (revision 251829)3+++ sys/dev/fxp/if_fxp.c (revision 251830)4@@ -1074,7 +1074,8 @@ fxp_suspend(device_t dev)5pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;6sc->flags |= FXP_FLAG_WOL;7/* Reconfigure hardware to accept magic frames. */8- fxp_init_body(sc, 1);9+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;10+ fxp_init_body(sc, 0);11}12pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);13}14@@ -2140,8 +2141,10 @@ fxp_tick(void *xsc)15*/16if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) {17sc->rx_idle_secs = 0;18- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)19+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {20+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;21fxp_init_body(sc, 1);22+ }23return;24}25/*26@@ -2239,6 +2242,7 @@ fxp_watchdog(struct fxp_softc *sc)27device_printf(sc->dev, "device timeout\n");28sc->ifp->if_oerrors++;2930+ sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;31fxp_init_body(sc, 1);32}3334@@ -2273,6 +2277,10 @@ fxp_init_body(struct fxp_softc *sc, int setmedia)35int i, prm;3637FXP_LOCK_ASSERT(sc, MA_OWNED);38+39+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)40+ return;41+42/*43* Cancel any pending I/O44*/45@@ -2812,6 +2820,7 @@ fxp_miibus_statchg(device_t dev)46*/47if (sc->revision == FXP_REV_82557)48return;49+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;50fxp_init_body(sc, 0);51}5253@@ -2835,9 +2844,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr54if (ifp->if_flags & IFF_UP) {55if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) &&56((ifp->if_flags ^ sc->if_flags) &57- (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0)58+ (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0) {59+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;60fxp_init_body(sc, 0);61- else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)62+ } else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)63fxp_init_body(sc, 1);64} else {65if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)66@@ -2850,8 +2860,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr67case SIOCADDMULTI:68case SIOCDELMULTI:69FXP_LOCK(sc);70- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)71+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {72+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;73fxp_init_body(sc, 0);74+ }75FXP_UNLOCK(sc);76break;7778@@ -2941,8 +2953,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr79~(IFCAP_VLAN_HWTSO | IFCAP_VLAN_HWCSUM);80reinit++;81}82- if (reinit > 0 && ifp->if_flags & IFF_UP)83+ if (reinit > 0 && (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {84+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;85fxp_init_body(sc, 0);86+ }87FXP_UNLOCK(sc);88VLAN_CAPABILITIES(ifp);89break;909192