summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2011-10-17 19:49:00 +0000
committeryongari <yongari@FreeBSD.org>2011-10-17 19:49:00 +0000
commit4c371e596be040085df1b5f9e469ab9fd8278c89 (patch)
treed177532a5533584316ef20ec33ef25a4e8e17cac /sys/dev
parent56e15a778cfacd77cc855073167c952c91381994 (diff)
downloadFreeBSD-src-4c371e596be040085df1b5f9e469ab9fd8278c89.zip
FreeBSD-src-4c371e596be040085df1b5f9e469ab9fd8278c89.tar.gz
Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in mii_pollstat(), updating user supplied structure should be done before dropping a driver lock. Reported by: Karim (fodillemlinkarimi <> gmail dot com)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/age/if_age.c2
-rw-r--r--sys/dev/alc/if_alc.c2
-rw-r--r--sys/dev/ale/if_ale.c2
-rw-r--r--sys/dev/lge/if_lge.c2
-rw-r--r--sys/dev/msk/if_msk.c2
-rw-r--r--sys/dev/nfe/if_nfe.c2
-rw-r--r--sys/dev/nge/if_nge.c2
-rw-r--r--sys/dev/nve/if_nve.c2
-rw-r--r--sys/dev/re/if_re.c2
-rw-r--r--sys/dev/sge/if_sge.c2
-rw-r--r--sys/dev/sis/if_sis.c2
-rw-r--r--sys/dev/vge/if_vge.c2
-rw-r--r--sys/dev/vr/if_vr.c2
-rw-r--r--sys/dev/vte/if_vte.c2
14 files changed, 14 insertions, 14 deletions
diff --git a/sys/dev/age/if_age.c b/sys/dev/age/if_age.c
index a1ab8c7..175dd97 100644
--- a/sys/dev/age/if_age.c
+++ b/sys/dev/age/if_age.c
@@ -282,9 +282,9 @@ age_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
mii = device_get_softc(sc->age_miibus);
mii_pollstat(mii);
- AGE_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+ AGE_UNLOCK(sc);
}
/*
diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c
index c13cb18..c73075c 100644
--- a/sys/dev/alc/if_alc.c
+++ b/sys/dev/alc/if_alc.c
@@ -349,9 +349,9 @@ alc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
mii = device_get_softc(sc->alc_miibus);
mii_pollstat(mii);
- ALC_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+ ALC_UNLOCK(sc);
}
static int
diff --git a/sys/dev/ale/if_ale.c b/sys/dev/ale/if_ale.c
index bdee4d8..e80bfbb 100644
--- a/sys/dev/ale/if_ale.c
+++ b/sys/dev/ale/if_ale.c
@@ -270,9 +270,9 @@ ale_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
mii = device_get_softc(sc->ale_miibus);
mii_pollstat(mii);
- ALE_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+ ALE_UNLOCK(sc);
}
static int
diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c
index 1679cf3..c4ddef8 100644
--- a/sys/dev/lge/if_lge.c
+++ b/sys/dev/lge/if_lge.c
@@ -1430,9 +1430,9 @@ lge_ifmedia_sts(ifp, ifmr)
LGE_LOCK(sc);
mii = device_get_softc(sc->lge_miibus);
mii_pollstat(mii);
- LGE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ LGE_UNLOCK(sc);
return;
}
diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c
index be4ac5d..b060949 100644
--- a/sys/dev/msk/if_msk.c
+++ b/sys/dev/msk/if_msk.c
@@ -995,9 +995,9 @@ msk_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
mii = device_get_softc(sc_if->msk_miibus);
mii_pollstat(mii);
- MSK_IF_UNLOCK(sc_if);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ MSK_IF_UNLOCK(sc_if);
}
static int
diff --git a/sys/dev/nfe/if_nfe.c b/sys/dev/nfe/if_nfe.c
index 28a3c01..3c36fe7 100644
--- a/sys/dev/nfe/if_nfe.c
+++ b/sys/dev/nfe/if_nfe.c
@@ -2952,10 +2952,10 @@ nfe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
NFE_LOCK(sc);
mii = device_get_softc(sc->nfe_miibus);
mii_pollstat(mii);
- NFE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ NFE_UNLOCK(sc);
}
diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c
index dd16606..db20ad2 100644
--- a/sys/dev/nge/if_nge.c
+++ b/sys/dev/nge/if_nge.c
@@ -2417,9 +2417,9 @@ nge_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
NGE_LOCK(sc);
mii = device_get_softc(sc->nge_miibus);
mii_pollstat(mii);
- NGE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ NGE_UNLOCK(sc);
}
static int
diff --git a/sys/dev/nve/if_nve.c b/sys/dev/nve/if_nve.c
index 7bb5c58..1428662 100644
--- a/sys/dev/nve/if_nve.c
+++ b/sys/dev/nve/if_nve.c
@@ -1202,10 +1202,10 @@ nve_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
NVE_LOCK(sc);
mii = device_get_softc(sc->miibus);
mii_pollstat(mii);
- NVE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ NVE_UNLOCK(sc);
return;
}
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 3c45cc9..704276e 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -3214,9 +3214,9 @@ re_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
RL_LOCK(sc);
mii_pollstat(mii);
- RL_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ RL_UNLOCK(sc);
}
static int
diff --git a/sys/dev/sge/if_sge.c b/sys/dev/sge/if_sge.c
index 03bf900..c56760d 100644
--- a/sys/dev/sge/if_sge.c
+++ b/sys/dev/sge/if_sge.c
@@ -1746,9 +1746,9 @@ sge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
return;
}
mii_pollstat(mii);
- SGE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ SGE_UNLOCK(sc);
}
static int
diff --git a/sys/dev/sis/if_sis.c b/sys/dev/sis/if_sis.c
index 9290ff7..d0be783 100644
--- a/sys/dev/sis/if_sis.c
+++ b/sys/dev/sis/if_sis.c
@@ -2237,9 +2237,9 @@ sis_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
SIS_LOCK(sc);
mii = device_get_softc(sc->sis_miibus);
mii_pollstat(mii);
- SIS_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ SIS_UNLOCK(sc);
}
static int
diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c
index 9529702..f4ce30a 100644
--- a/sys/dev/vge/if_vge.c
+++ b/sys/dev/vge/if_vge.c
@@ -2173,9 +2173,9 @@ vge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
return;
}
mii_pollstat(mii);
- VGE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ VGE_UNLOCK(sc);
}
static void
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c
index 94e7b4a..0bcef0e 100644
--- a/sys/dev/vr/if_vr.c
+++ b/sys/dev/vr/if_vr.c
@@ -2155,9 +2155,9 @@ vr_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
return;
}
mii_pollstat(mii);
- VR_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+ VR_UNLOCK(sc);
}
static int
diff --git a/sys/dev/vte/if_vte.c b/sys/dev/vte/if_vte.c
index 1b38dec..5e49154 100644
--- a/sys/dev/vte/if_vte.c
+++ b/sys/dev/vte/if_vte.c
@@ -284,9 +284,9 @@ vte_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
mii = device_get_softc(sc->vte_miibus);
mii_pollstat(mii);
- VTE_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+ VTE_UNLOCK(sc);
}
static int
OpenPOWER on IntegriCloud