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