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:
Pyun YongHyeon 2011-10-17 19:51:38 +00:00
parent 57c81d92ae
commit e9e549ef70
5 changed files with 5 additions and 5 deletions

View File

@ -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);
}
/*

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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