Pi 5: NCM gadget (usb_f_ncm on dwc2) hard-locks the system during link-up with a macOS host
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c, linux, macos
- Domain
- embedded-iot, networking, operating-systems
Research direction
Start by reproducing the configfs ncm gadget setup with usb_f_ncm on the Raspberry Pi 5 and collect the dwc2 and gadget endpoint traces described in the issue. Compare the NCM link-notification sequence with the working g_ether/ECM setup and use the linked netconsole captures as a reference. Done means the NCM gadget completes link-up without a system lockup and can carry traffic.
Written by the indexing model from the issue text.
Description
Describe the bug
Binding a configfs gadget with a single ncm function on a Raspberry Pi 5 hard-locks the whole system as soon as a macOS host starts enumerating it. The last kernel messages are always the same three dwc2 lines (bound driver, high-speed, new address 1), then nothing: no oops, no soft-lockup report, and oops=panic panic=10 never fires, so the board needs a power cycle. Reproduced three times, identically, including once with RAM capped to 3 GB (mem=3G) to rule out DMA addressing above the controller's 32-bit reach. g_ether (ECM) on the same setup enumerates and passes traffic in both directions, so this is specific to the NCM function on dwc2/BCM2712.
Steps to reproduce the behaviour
dtoverlay=dwc2,dr_mode=peripheralunder[all]inconfig.txt;PSU_MAX_CURRENT=3000in the EEPROM config so the Mac can see the gadget at all (see #6569).- Boot with the Pi connected to an Apple Silicon Mac (macOS 26.6.2) by USB-C to USB-C, Pi powered by the Mac.
g_etherenumerates fine at this point. - Switch to NCM:
modprobe libcomposite usb_f_ncm
modprobe -r g_ether
cd /sys/kernel/config/usb_gadget && mkdir g1 && cd g1
echo 0x2e8a > idVendor; echo 0x0013 > idProduct; echo 0x0200 > bcdUSB
mkdir -p strings/0x409 configs/c.1/strings/0x409 functions/ncm.usb0
echo "Raspberry Pi Ltd." > strings/0x409/manufacturer; echo "Raspberry Pi USB Gadget" > strings/0x409/product
echo NCM > configs/c.1/strings/0x409/configuration; echo 250 > configs/c.1/MaxPower
echo 02:6c:cc:fa:69:4e > functions/ncm.usb0/host_addr; echo 02:6c:cc:fa:69:4f > functions/ncm.usb0/dev_addr
ln -s functions/ncm.usb0 configs/c.1/
echo 1000480000.usb > UDC
- The Mac resets the bus, assigns an address, reads descriptors, and shows the "Allow accessory to connect?" prompt (all fine). The Pi locks up hard a moment later, as the NCM function goes live and starts sending link notifications (see Logs). Full system lockup; only a power cycle recovers it.
Device (s)
Raspberry Pi 5
System
Raspberry Pi OS trixie (Debian 13), 8GB board
Linux blackbox 6.18.39+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.18.39-1+rpt1 (2026-07-29) aarch64
(also reproduced on 6.18.34+rpt-rpi-2712)
Bootloader: 2026/05/26 16:01:25
Host: MacBook (Apple M2), macOS 26.6.2
Logs
With tp_printk on the kernel command line and events/gadget/enable=1, the gadget endpoint activity is printed to the kernel log and streamed over netconsole (eth0). This shows the hang is not during enumeration — descriptors are read, the address is set, the config is applied, and the function goes live. The system dies during the NCM link-up notification.
Tail of the capture, right before it goes silent:
usb_gadget_giveback_request: ep0: req ... length 8/8 ... status 0 --> 0
usb_ep_queue: ep0: req ... length 0/0 ... status -115 --> 0
usb_gadget_giveback_request: ep0: req ... length 0/0 ... status 0 --> 0
usb_gadget_giveback_request: ep2in: req ... length 16/16 ... status 0 --> 0 # NCM notification sent
usb_ep_queue: ep2in: req ... length 0/16 ... status -115 --> 0
usb_gadget_giveback_request: ep2in: req ... length 16/16 ... status 0 --> 0 # second notification sent
usb_ep_queue: ep2in: req ... length 0/8 ... status -115 --> 0 # third notification queued
<complete silence, no oops, no further output>
Immediately before this, ep1out (bulk OUT) had ~16 requests queued at 16384 bytes each and ep2in (the interrupt/notification endpoint) was cycling 16-byte then 8-byte transfers — i.e. the CDC-NCM NETWORK_CONNECTION / SPEED_CHANGE notification sequence. The lockup happens as the function transitions to carrying data, not while the host is reading descriptors. g_ether (ECM) on the identical setup gets past this point and passes traffic.
ssh over both Wi-Fi and Ethernet drops at the same instant, so it is a full system lockup. A systemd-fed hardware watchdog (RuntimeWatchdogSec=15, BCM2835 WDT) did not reset the board — the lockup is hard enough that the reset path never runs — so recovery required a manual power cycle. No oops, no soft/hard-lockup report (neither detector is enabled in this kernel config).
Additional context
Motivation: g_ether/ECM is unusable with current macOS because AppleUserECM stops transmitting after ~150 frames per enumeration (Apple FB24614121, see raspberrypi/rpi-usb-gadget#27), and NCM is the only other Ethernet class macOS drives natively. I have not yet been able to test NCM against a Linux host on this board, so I cannot say whether the lockup is host-specific. Happy to test patches or capture more state; netconsole over the dongle is set up.
Full captures (netconsole output from the tracepoint run, and from the earlier mem=3G run): https://gist.github.com/JAKONL/59430a4cc738b689f71e3d225962e904
- Dominant language
- C
- Stars
- 13.2k
- Forks
- 5.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 21
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7415 · 2 comments · 1 reaction ·
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/linux#7399 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
raspberrypi/linux#7357 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7054 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
raspberrypi/linux#7634 · 8 comments · 1 reaction ·
All issues in raspberrypi/linux
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·