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)
This commit is contained in:
parent
57c81d92ae
commit
e9e549ef70
@ -1032,9 +1032,9 @@ aue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
|
||||
AUE_LOCK(sc);
|
||||
mii_pollstat(mii);
|
||||
AUE_UNLOCK(sc);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
AUE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -452,9 +452,9 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
|
||||
AXE_LOCK(sc);
|
||||
mii_pollstat(mii);
|
||||
AXE_UNLOCK(sc);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
AXE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -551,10 +551,10 @@ mos_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
|
||||
MOS_LOCK(sc);
|
||||
mii_pollstat(mii);
|
||||
MOS_UNLOCK(sc);
|
||||
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
MOS_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -889,9 +889,9 @@ rue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
|
||||
RUE_LOCK(sc);
|
||||
mii_pollstat(mii);
|
||||
RUE_UNLOCK(sc);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
RUE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -751,9 +751,9 @@ udav_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
|
||||
UDAV_LOCK(sc);
|
||||
mii_pollstat(mii);
|
||||
UDAV_UNLOCK(sc);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
UDAV_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user