svn commit: r229060 - stable/9/sys/dev/usb/net

Pyun YongHyeon yongari at FreeBSD.org
Sat Dec 31 01:22:17 UTC 2011


Author: yongari
Date: Sat Dec 31 01:22:16 2011
New Revision: 229060
URL: http://svn.freebsd.org/changeset/base/229060

Log:
  MFC r226479:
    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)

Modified:
  stable/9/sys/dev/usb/net/if_aue.c
  stable/9/sys/dev/usb/net/if_axe.c
  stable/9/sys/dev/usb/net/if_mos.c
  stable/9/sys/dev/usb/net/if_rue.c
  stable/9/sys/dev/usb/net/if_udav.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/dev/usb/net/if_aue.c
==============================================================================
--- stable/9/sys/dev/usb/net/if_aue.c	Sat Dec 31 01:10:29 2011	(r229059)
+++ stable/9/sys/dev/usb/net/if_aue.c	Sat Dec 31 01:22:16 2011	(r229060)
@@ -1032,9 +1032,9 @@ aue_ifmedia_sts(struct ifnet *ifp, struc
 
 	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);
 }
 
 /*

Modified: stable/9/sys/dev/usb/net/if_axe.c
==============================================================================
--- stable/9/sys/dev/usb/net/if_axe.c	Sat Dec 31 01:10:29 2011	(r229059)
+++ stable/9/sys/dev/usb/net/if_axe.c	Sat Dec 31 01:22:16 2011	(r229060)
@@ -452,9 +452,9 @@ axe_ifmedia_sts(struct ifnet *ifp, struc
 
 	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

Modified: stable/9/sys/dev/usb/net/if_mos.c
==============================================================================
--- stable/9/sys/dev/usb/net/if_mos.c	Sat Dec 31 01:10:29 2011	(r229059)
+++ stable/9/sys/dev/usb/net/if_mos.c	Sat Dec 31 01:22:16 2011	(r229060)
@@ -551,10 +551,10 @@ mos_ifmedia_sts(struct ifnet *ifp, struc
 
 	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

Modified: stable/9/sys/dev/usb/net/if_rue.c
==============================================================================
--- stable/9/sys/dev/usb/net/if_rue.c	Sat Dec 31 01:10:29 2011	(r229059)
+++ stable/9/sys/dev/usb/net/if_rue.c	Sat Dec 31 01:22:16 2011	(r229060)
@@ -889,9 +889,9 @@ rue_ifmedia_sts(struct ifnet *ifp, struc
 
 	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

Modified: stable/9/sys/dev/usb/net/if_udav.c
==============================================================================
--- stable/9/sys/dev/usb/net/if_udav.c	Sat Dec 31 01:10:29 2011	(r229059)
+++ stable/9/sys/dev/usb/net/if_udav.c	Sat Dec 31 01:22:16 2011	(r229060)
@@ -751,9 +751,9 @@ udav_ifmedia_status(struct ifnet *ifp, s
 
 	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


More information about the svn-src-stable-9 mailing list