aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-12-19 11:00:11 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-12-19 11:00:11 +0000
commit412bbd0811f02ef2d6691e66a0b15a2a7dbd9865 (patch)
tree72cf972f3ab5f2b71925b227450712422c3cbc0a
parentbb0358d4d7cc3d16857cc1bf48a5d412278af323 (diff)
downloadsrc-412bbd0811f02ef2d6691e66a0b15a2a7dbd9865.tar.gz
src-412bbd0811f02ef2d6691e66a0b15a2a7dbd9865.zip
Move SYSCTL_ADD_PROC() to unlocked context in if_ure to avoid lock order reversal.
MFC after: 1 week Reported by: Mark Millard <marklmi@yahoo.com> Sponsored by: Mellanox Technologies // NVIDIA Networking
Notes
Notes: svn path=/head/; revision=368799
-rw-r--r--sys/dev/usb/net/if_ure.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index 798c8b1aa09f..d552f2c69f56 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -959,8 +959,6 @@ static void
ure_attach_post(struct usb_ether *ue)
{
struct ure_softc *sc = uether_getsc(ue);
- struct sysctl_ctx_list *sctx;
- struct sysctl_oid *soid;
sc->sc_rxstarted = 0;
sc->sc_phyno = 0;
@@ -988,18 +986,13 @@ ure_attach_post(struct usb_ether *ue)
sc->sc_ue.ue_eaddr[0] &= ~0x01; /* unicast */
sc->sc_ue.ue_eaddr[0] |= 0x02; /* locally administered */
}
-
- sctx = device_get_sysctl_ctx(sc->sc_ue.ue_dev);
- soid = device_get_sysctl_tree(sc->sc_ue.ue_dev);
- SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "chipver",
- CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
- ure_sysctl_chipver, "A",
- "Return string with chip version.");
}
static int
ure_attach_post_sub(struct usb_ether *ue)
{
+ struct sysctl_ctx_list *sctx;
+ struct sysctl_oid *soid;
struct ure_softc *sc;
struct ifnet *ifp;
int error;
@@ -1033,6 +1026,13 @@ ure_attach_post_sub(struct usb_ether *ue)
BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, 0);
mtx_unlock(&Giant);
+ sctx = device_get_sysctl_ctx(sc->sc_ue.ue_dev);
+ soid = device_get_sysctl_tree(sc->sc_ue.ue_dev);
+ SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "chipver",
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
+ ure_sysctl_chipver, "A",
+ "Return string with chip version.");
+
return (error);
}