Module Name:    src
Committed By:   riastradh
Date:           Sat Jan  8 17:35:05 UTC 2022

Modified Files:
        src/sys/dev/mii: urlphy.c

Log Message:
urlphy(4): Fix missing mii locking in urlphy_attach.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/mii/urlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/urlphy.c
diff -u src/sys/dev/mii/urlphy.c:1.38 src/sys/dev/mii/urlphy.c:1.39
--- src/sys/dev/mii/urlphy.c:1.38	Mon Aug 24 04:49:05 2020
+++ src/sys/dev/mii/urlphy.c	Sat Jan  8 17:35:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $	*/
+/*	$NetBSD: urlphy.c,v 1.39 2022/01/08 17:35:05 riastradh Exp $	*/
 /*
  * Copyright (c) 2001, 2002
  *     Shingo WATANABE <n...@nabechan.org>.  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.38 2020/08/24 04:49:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.39 2022/01/08 17:35:05 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,11 +118,16 @@ urlphy_attach(device_t parent, device_t 
 		    "ignoring this PHY, non-zero instance\n");
 		return;
 	}
+
+	mii_lock(mii);
+
 	PHY_RESET(sc);
 
 	PHY_READ(sc, MII_BMSR, &sc->mii_capabilities);
 	sc->mii_capabilities &= ma->mii_capmask;
 
+	mii_unlock(mii);
+
 	mii_phy_add_media(sc);
 }
 

Reply via email to