git: 83067a22396f - main - ure: Initialize ifm_active in ure_ifmedia_sts
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Nov 2026 16:06:02 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=83067a22396f5609f3e8be035eb8f316ed52b895
commit 83067a22396f5609f3e8be035eb8f316ed52b895
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-10-30 19:26:28 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-11-13 16:05:36 +0000
ure: Initialize ifm_active in ure_ifmedia_sts
Most ure(4) devices use mii; 8156 and 8156B do not and have special
cases throughout the driver.
ifmedia_ioctl() sets ifmr->ifm_active to ifm_cur->ifm_media before
calling the status callback. The 8156 case in ure_ifmedia_sts ORs in
the subtype and duplex flags to the existing value, which may result in
garbage values.
Instead, start by setting ifm_active to just IFM_ETHER before ORing in
other bits.
Reported by: llm-postcr
Reviewed by: kbowling, pouria
Fixes: d4cf41a99b40 ("Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(4).")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61158
---
sys/dev/usb/net/if_ure.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index a3468d7869f4..5024d1c869fb 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -1439,6 +1439,7 @@ ure_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
sc = if_getsoftc(ifp);
if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) {
URE_LOCK(sc);
+ ifmr->ifm_active = IFM_ETHER;
ifmr->ifm_status = IFM_AVALID;
if (ure_get_link_status(sc)) {
ifmr->ifm_status |= IFM_ACTIVE;
@@ -1457,6 +1458,8 @@ ure_ifmedia_sts(if_t ifp, struct ifmediareq *ifmr)
ifmr->ifm_active |= IFM_1000_T;
else if (status & URE_PHYSTATUS_2500MBPS)
ifmr->ifm_active |= IFM_2500_T;
+ } else {
+ ifmr->ifm_active |= IFM_NONE;
}
URE_UNLOCK(sc);
return;