Date: Sat, 19 Dec 2020 11:00:11 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368799 - head/sys/dev/usb/net Message-ID: <202012191100.0BJB0BIa051960@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Sat Dec 19 11:00:11 2020 New Revision: 368799 URL: https://svnweb.freebsd.org/changeset/base/368799 Log: 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 Modified: head/sys/dev/usb/net/if_ure.c Modified: head/sys/dev/usb/net/if_ure.c ============================================================================== --- head/sys/dev/usb/net/if_ure.c Sat Dec 19 10:31:25 2020 (r368798) +++ head/sys/dev/usb/net/if_ure.c Sat Dec 19 11:00:11 2020 (r368799) @@ -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; @@ -1032,6 +1025,13 @@ ure_attach_post_sub(struct usb_ether *ue) uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012191100.0BJB0BIa051960>