diff options
author | yongari <yongari@FreeBSD.org> | 2011-10-17 19:51:38 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2011-10-17 19:51:38 +0000 |
commit | b773d9298b4e00625c15d55e3c71f9ce2b72972e (patch) | |
tree | 4dae49a099c250da9471a581badd0370b5e3219c /sys/dev | |
parent | 4c371e596be040085df1b5f9e469ab9fd8278c89 (diff) | |
download | FreeBSD-src-b773d9298b4e00625c15d55e3c71f9ce2b72972e.zip FreeBSD-src-b773d9298b4e00625c15d55e3c71f9ce2b72972e.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/usb/net/if_aue.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/net/if_axe.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/net/if_mos.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/net/if_rue.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/net/if_udav.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c index 86bfe20..adf47f4 100644 --- a/sys/dev/usb/net/if_aue.c +++ b/sys/dev/usb/net/if_aue.c @@ -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); } /* diff --git a/sys/dev/usb/net/if_axe.c b/sys/dev/usb/net/if_axe.c index a440294..b2aef68 100644 --- a/sys/dev/usb/net/if_axe.c +++ b/sys/dev/usb/net/if_axe.c @@ -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 diff --git a/sys/dev/usb/net/if_mos.c b/sys/dev/usb/net/if_mos.c index 0cbea91..5fbbb39 100644 --- a/sys/dev/usb/net/if_mos.c +++ b/sys/dev/usb/net/if_mos.c @@ -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 diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c index 3e3a151..c874c1d 100644 --- a/sys/dev/usb/net/if_rue.c +++ b/sys/dev/usb/net/if_rue.c @@ -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 diff --git a/sys/dev/usb/net/if_udav.c b/sys/dev/usb/net/if_udav.c index ea35127..e9a0504 100644 --- a/sys/dev/usb/net/if_udav.c +++ b/sys/dev/usb/net/if_udav.c @@ -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 |