Bug 290314 - sys/dev/dc/if_dc.c net driver crashes when being configured
Summary: sys/dev/dc/if_dc.c net driver crashes when being configured
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 16.0-CURRENT
Hardware: powerpc Any
: --- Affects Some People
Assignee: Bjoern A. Zeeb
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-17 01:20 UTC by Chris Johns
Modified: 2026-01-16 20:04 UTC (History)
6 users (show)

See Also:
bz: mfc-stable15+
bz: mfc-stable14+
bz: mfc-stable13-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Johns 2025-10-17 01:20:42 UTC
The change https://github.com/freebsd/freebsd-src/commit/51e80820552e075634c076d989cda90beb8169ac updates the DC driver to use the if_foreach_llmaddr() KPI and introduced a bug the file sys/dev/dc/if_dc.c

The line:

  if_foreach_llmaddr(ifp, dc_hash_maddr_21143, sp);

in dc_setfilt_21143() passes `sp` however the the handler function above (dc_hash_maddr_21143()) expect `sc`. Changing sp to sc lets the driver run.

Notes:

1. We are seeing the crash on RTEMS running on the 14-stable branch.

2. The hardware is a PowerPC MVME2700 board (yes these are in wide use in the EPICS community running RTEMS).

3. The active device on this board is the original rev 1 device with an unknown PHY.

4. The issue is also present on CURRENT
Comment 1 Chris Johns 2025-10-17 01:43:56 UTC
The issue in RTEMS is https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/64
Comment 2 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-10-17 10:12:18 UTC
(In reply to Chris Johns from comment #0)

Hi Chris,

if I understand you correctly (and from looking) it's just the single character fix to make it all work again, which as I understand you tested?
If so we can certainly commit that.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-10-17 16:47:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=33afdf0e356d84ffe5c62c886f84cf12ba147d3e

commit 33afdf0e356d84ffe5c62c886f84cf12ba147d3e
Author:     Chris Johns <chrisj@rtems.org>
AuthorDate: 2025-10-17 12:38:30 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-10-17 16:45:58 +0000

    dc(4): fix argument to if_foreach_llmaddr() for 21143.

    As found on RTEMS the argument to if_foreach_llmaddr() was wrong
    causing crashes.

    Fixes:          51e80820552e0
    PR:             290314
    MFC after:      3 days

 sys/dev/dc/if_dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 Matt Rippa 2025-10-20 00:27:08 UTC
(In reply to Bjoern A. Zeeb from comment #2)

Hi Bjoern,

Yes, I tested on hardware last week in my lab. I then reviewed with Chris. The change allows the driver to run.

Cheers,
-Matt
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-10-20 18:34:55 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=10c71151ade7b5f021b49b7e117059730a2ddb56

commit 10c71151ade7b5f021b49b7e117059730a2ddb56
Author:     Chris Johns <chrisj@rtems.org>
AuthorDate: 2025-10-17 12:38:30 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-10-20 18:33:08 +0000

    dc(4): fix argument to if_foreach_llmaddr() for 21143.

    As found on RTEMS the argument to if_foreach_llmaddr() was wrong
    causing crashes.

    Fixes:          51e80820552e0
    PR:             290314

    (cherry picked from commit 33afdf0e356d84ffe5c62c886f84cf12ba147d3e)

 sys/dev/dc/if_dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-10-21 05:48:44 UTC
A commit in branch releng/15.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=71f065aab558123a35a885b1a9e205380fd551f5

commit 71f065aab558123a35a885b1a9e205380fd551f5
Author:     Chris Johns <chrisj@rtems.org>
AuthorDate: 2025-10-17 12:38:30 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-21 05:45:08 +0000

    dc(4): fix argument to if_foreach_llmaddr() for 21143.

    As found on RTEMS the argument to if_foreach_llmaddr() was wrong
    causing crashes.

    Approved by:    re (cperciva)
    Fixes:          51e80820552e0
    PR:             290314

    (cherry picked from commit 33afdf0e356d84ffe5c62c886f84cf12ba147d3e)
    (cherry picked from commit 10c71151ade7b5f021b49b7e117059730a2ddb56)

 sys/dev/dc/if_dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 Mark Johnston freebsd_committer freebsd_triage 2025-11-21 16:11:33 UTC
Should we merge this change to stable/13 and 14?
Comment 8 Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-11-21 18:42:06 UTC
(In reply to Mark Johnston from comment #7)

I will merge it to stable/14 but not stable/13 anymore.  I have a pile of stable/14 sitting around to MFC but let's sort more pressing (15.0 related etc) bugs before breaking the next bits ;-)
Comment 9 Chris Johns 2025-11-21 22:50:26 UTC
RTEMS is using 14 in releases and we will add 15 when released (and someone updates our 15 branches).
Comment 10 commit-hook freebsd_committer freebsd_triage 2026-01-16 19:42:38 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6d7d95b4758d04adcf051d6dcf7355caf4a1f2cd

commit 6d7d95b4758d04adcf051d6dcf7355caf4a1f2cd
Author:     Chris Johns <chrisj@rtems.org>
AuthorDate: 2025-10-17 12:38:30 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-01-16 19:37:51 +0000

    dc(4): fix argument to if_foreach_llmaddr() for 21143.

    As found on RTEMS the argument to if_foreach_llmaddr() was wrong
    causing crashes.

    Fixes:          51e80820552e0
    PR:             290314

    (cherry picked from commit 33afdf0e356d84ffe5c62c886f84cf12ba147d3e)
    (cherry picked from commit 10c71151ade7b5f021b49b7e117059730a2ddb56)

 sys/dev/dc/if_dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 11 Bjoern A. Zeeb freebsd_committer freebsd_triage 2026-01-16 20:04:47 UTC
Merged to stable/14 for 14.4-R as well.