git: 843c1b516019 - stable/14 - cxgb(4): Register ifmedia callbacks before ether_ifattach.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 31 Oct 2024 01:53:48 UTC
The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=843c1b516019efec22295234bdda26b838b1e6b7 commit 843c1b516019efec22295234bdda26b838b1e6b7 Author: ScottD <biscuits.carry.0j@icloud.com> AuthorDate: 2024-10-28 20:48:16 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> CommitDate: 2024-10-31 01:09:06 +0000 cxgb(4): Register ifmedia callbacks before ether_ifattach. This prevents a panic that occurs if netlink tries to invoke the driver's media callbacks during ifattach. PR: 282374 Reported by: ScottD <biscuits.carry.0j@icloud.com> (cherry picked from commit f2daf89954a45c7eed22990dd4cf2cf879763dc0) --- sys/dev/cxgb/cxgb_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index 4d754aa8b1b7..c159849076c5 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -1041,6 +1041,11 @@ cxgb_port_attach(device_t dev) if_sethwassistbits(ifp, 0, CSUM_TSO); } + /* Create a list of media supported by this port */ + ifmedia_init(&p->media, IFM_IMASK, cxgb_media_change, + cxgb_media_status); + cxgb_build_medialist(p); + ether_ifattach(ifp, p->hw_addr); /* Attach driver debugnet methods. */ @@ -1055,11 +1060,6 @@ cxgb_port_attach(device_t dev) return (err); } - /* Create a list of media supported by this port */ - ifmedia_init(&p->media, IFM_IMASK, cxgb_media_change, - cxgb_media_status); - cxgb_build_medialist(p); - t3_sge_init_port(p); return (err);