Skip to content

thunderbolt: check DROM sizes, DP bandwidth request adapters and XDomain property blocks - #3209

Merged
RyanTheTide merged 11 commits into
mainfrom
fix/tb-drom-dpbw-xdomain
Dec 1, 2026
Merged

RyanTheTide merged 11 commits into
mainfrom
fix/tb-drom-dpbw-xdomain

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What: The Thunderbolt/USB4 connection manager now checks five things a router or remote host reports before it uses them:

  • DROM entry and header sizes (one commit is upstream's b946f490be57, cherry-picked)
  • the adapter number in a DP bandwidth notification
  • the out adapter of each hop entry during path discovery, including a path that ends early when its entries are read again
  • a zero-length XDomain properties block, which made the properties request repeat for as long as the remote host answered
  • a properties block shorter than its two-dword root directory header

KUnit tests cover each.
Tested: KUnit thunderbolt suite at c03c53f on arm64 QEMU with KASAN: 81/81 pass (8 new); each new test fails without its fix. Hardware rows still owed (below).
Risk: two-way door · every Mac with USB4/Thunderbolt (shared drivers/thunderbolt code)
Not yet: hardware rows at this head on J714s (M5 Pro, USB4 dock) and J773g (M4 mini): dock attach and detach, displays over the dock, dock storage or Ethernet I/O, one deep sleep with the dock attached, against base.

Details
  • thunderbolt: Require complete DROM entry headers (upstream b946f490be57 by Pengpeng Hou). The entry loop needs both header bytes and an entry length of at least the header. Without it, a one-byte name entry underflows len - 2 and kstrndup() reads past the DROM.
  • thunderbolt: Check the DROM header and product descriptor sizes. Upstream does not cover these two cases:
    • tb_drom_parse() read the revision and data length (bytes 13 to 15) before checking that the DROM is that long. USB4 and NVM copies accept any reported size, down to 13 bytes. The version 1 parser also read the IDs at bytes 16 to 21 of a DROM sized for the 16-byte USB4 header. The DROM is now checked against the USB4 header size first, and against the full header before the version 1 parser runs.
    • A product descriptor entry (index 9) is now ignored unless it reaches the product ID. The struct isn't packed, so the bound is offsetofend(), not sizeof().
  • thunderbolt: Check the adapter of a DP bandwidth request. The six-bit adapter number indexed sw->ports[] without a check against max_port_number, unlike the hotplug handler. Out-of-range adapters are now refused before indexing. The upstream port and non-DP-IN adapters were already refused by tb_port_is_dpin().
  • thunderbolt: Reject an empty XDomain properties block. With data_length == 0 nothing was copied, the offset stayed at 0, and while (!data_len || ...) sent the same request again forever on the ordered domain workqueue. The first response now fails the request, and the loop runs only while data is missing. Every response that passes the existing length check carries at least one data dword, and the copy is clamped to the block, so each round moves the offset forward.
  • thunderbolt: Check the adapter of each hop in path discovery. Discovery took the adapter a path leaves through from the hop entry's six-bit out_port, and indexed sw->ports[] with it unchecked. That happens in tb_path_find_dst_port() and in both passes of tb_path_discover().
    • One helper now refuses an adapter past max_port_number with a rate-limited warning, and discovery of that path fails.
    • The second pass reads the entries again, so it checks again before allocating a HopID.
    • Mainline has the same unchecked indexing in drivers/thunderbolt/path.c (master as of this PR), so this is a candidate to send upstream.
    • Its KUnit test is in the same commit. It discovers paths from a hop stub reporting adapter max_port_number + 1 and 63, a valid adapter on the first read and an invalid one on the second, and the same for the source HopID lookup. It also checks that no HopID stays allocated.
  • thunderbolt: Stop path discovery when a hop re-read ends the path early. The second pass of tb_path_discover() follows each re-read out adapter's link. A router can name an in-range adapter without a link on the second read, which left p NULL for the next hop's read. The second pass now fails discovery when it runs out of adapters before the hops the first pass counted; the error path gives back the HopIDs already taken. KUnit: a path through a device router whose host entry, read again, goes out of the host's unlinked adapter 3.
  • thunderbolt: Check the property block holds the root directory header. tb_property_parse_dir() read the root directory's magic and length before checking the block length. The XDomain properties request allocates exactly the dwords the peer reports, so a one-dword block with the root magic was read past. Blocks shorter than the header are now refused. Mainline has the same code. KUnit: blocks of 0 and 1 dwords holding the root magic, each allocated to its exact size.
  • thunderbolt: Add KUnit tests for DROM sizes, DP bandwidth adapters and XDomain properties.
    • The DROM cases go through tb_drom_read() with the host DROM given as the device property the Apple path reads. They cover lengths 0, 1 and header-only, a one-byte tail, an overrun, a short product descriptor at the end of the DROM, and a revision 1 DROM sized for the USB4 header.
    • The DP bandwidth case sends notifications for adapters 14 (max_port_number + 1), 63, 0, 1, 7 (the host's upstream NHI adapter) and 5 (DP IN with no tunnel). It checks that nothing is tunneled and that the router reference is balanced.
    • The XDomain case answers requests through a static stub on tb_cfg_request_sync(). An empty block now fails after one request; on the old code it repeated until the stub stopped answering. A five-dword block arrives in two clamped responses.
    • The only runtime change for the tests is that stub hook. It is a no-op unless a KUnit test activates it, the same as the existing one in tb_cfg_read().
Evidence

Head c03c53f31c7a9cbc5e0bac09f1b6d5420522fe73, base main 40e5e29cc915.

./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 \
    --kunitconfig=tb.kunitconfig 'thunderbolt.*'
# tb.kunitconfig: KUNIT=y PCI=y USB4=y USB4_KUNIT_TEST=y KASAN=y KASAN_GENERIC=y
Tree Result
this head, W=1 Ran 81 tests: passed 81, no KASAN report, no warnings in drivers/thunderbolt
this head without the early-end check in path.c passed 80, failed 1: tb_test_path_discover_shorter (paging fault in tb_path_discover)
this head with the previous property.c passed 80, failed 1: tb_test_property_parse_short_block (KASAN slab-out-of-bounds in tb_property_parse_dir)
4c3ae6ca3418 with path.c from 97598779cdd5 passed 78, failed 1: tb_test_path_discover_out_port (KASAN slab-out-of-bounds in tb_path_discover)
97598779cdd5 with the four earlier fixes reverted (tests kept) passed 73, failed 5: tb_test_drom_entry_lengths (KASAN slab-out-of-bounds in strnlen from the one-byte name entry), tb_test_drom_product_descriptor, tb_test_drom_header_size (returns 0, expected -EIO), tb_test_dp_bandwidth_request_port (paging fault on adapter 14), tb_test_xdp_properties_progress (request repeated until the stub stopped answering)
97598779cdd5 merged with the two other USB4 branches, W=1 Ran 78 tests: passed 78, no warnings in the changed files

checkpatch.pl: clean apart from the commit ... upstream. line of the cherry-pick (stable style) and the test's initializer-list macros.

neosys007 and others added 5 commits November 26, 2026 02:26
commit b946f490be576691c4c47998cf1d4e41d637fbfb upstream.

tb_drom_parse_entries() checks for one byte remaining before reading a
DROM entry header, but the header occupies two bytes. It also accepts a
declared length of one byte.

A one-byte tail consequently makes the parser read entry->len outside
the DROM. A one-byte generic string entry reaches the subtype parser and
underflows its payload-length calculation.

Require a complete entry header before reading it and require the
declared entry length to cover that header. Use subtraction-based bounds
checks so the firmware-provided length cannot overflow the DROM extent
calculation.

While at it, use the actual const type instead of void * to make it
clear we only read these.

Signed-off-by: Pengpeng Hou <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>
Signed-off-by: Dj <[email protected]>
A router reports the size of its DROM, and tb_drom_parse() reads the
revision and data length at bytes 13 to 15 before it has checked that
the DROM is that long. The USB4 and NVM copies take any reported size,
so a DROM of 13 bytes makes the parser read past its allocation. The
version 1 parser also reads the vendor and model IDs at bytes 16 to 21,
past the end of a DROM that only has a USB4 header.

The generic product descriptor entry (index 9) is read for its vendor
and product IDs without checking that the entry holds them, so a short
entry at the end of the DROM reads past it too.

Check the DROM against the USB4 header size before reading the header,
and against the full header size before the version 1 parser reads it.
Ignore a product descriptor that ends before its product ID.

Signed-off-by: Dj <[email protected]>
A router's DP bandwidth notification names one of its adapters, and
tb_handle_dp_bandwidth_request() indexes sw->ports[] with that number
without checking it against the router's last adapter. The field is six
bits wide, so a router with fewer adapters makes the handler use a port
past the end of the array, and the warning for a non-DP IN adapter then
reads through it.

Reject the request if the router has no such adapter, as the hotplug
handler already does.

Fixes: 6ce3563 ("thunderbolt: Add support for DisplayPort bandwidth allocation mode")
Signed-off-by: Dj <[email protected]>
tb_xdp_properties_request() takes the size of the remote properties
block from the first response and keeps asking until it has all of it.
If the remote host reports a block of zero dwords, nothing is copied,
the offset stays at zero and the loop condition (!data_len) holds, so
the same request goes out again for as long as the remote host answers.
This runs on the domain's ordered workqueue, which handles nothing else
meanwhile.

An empty block cannot be parsed into properties anyway. Fail the request
when the first response reports one, and loop only while data is
missing. Each response then moves the offset forward: the length check
already requires data words in every response, and the copy is clamped
to what is left of the block.

Fixes: d1ff702 ("thunderbolt: Add support for XDomain discovery protocol")
Signed-off-by: Dj <[email protected]>
…d XDomain properties

Cover the checks of the previous commits:

- DROMs read through tb_drom_read() from the device property the
  Apple host path uses: entries of length 0 and 1, a header-only name,
  a single byte left at the end, an entry past the end, a product
  descriptor that ends inside its product ID, and a revision 1 DROM
  that is only as long as the USB4 header.
- DP bandwidth notifications for adapters the host router does not
  have (max_port_number + 1, 63), for its control, lane and NHI
  adapters, and for a DP IN adapter with no tunnel: none is tunneled
  and the router reference stays balanced.
- XDomain properties requests answered through a static stub on
  tb_cfg_request_sync(): an empty block fails after one request, and
  a five dword block arrives in two responses, the second clamped.

The stub is a no-op unless a KUnit test activates it, as the one in
tb_cfg_read() is.

Signed-off-by: Dj <[email protected]>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 26, 2026 08:08
@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 70d4557c: not ready yet

Check Detail
CI at head no failing: apple-build, host-tests, KUnit ane-boot, KUnit ane-pm, KUnit dcp-fabric, KUnit dcp-topology
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at 69399d99; the changed files are byte-identical at 70d4557c
Conflicts ok none
PR text ok Risk: two-way · every Mac with USB4/Thunderbolt (shared drivers/thunderbolt code)

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

Path discovery follows a path through the routers by reading each hop
entry from the router and taking the adapter the entry sends the path
out of from its six-bit out_port field. tb_path_find_dst_port() and
both passes of tb_path_discover() index sw->ports[] with that field
without checking it against the router's last adapter, so a router
that reports an adapter it does not have makes discovery use a port
past the end of the array. The second pass reads the entries again and
can get a different value than the first one checked.

Look the adapter up through one helper that refuses an out_port past
max_port_number with a rate-limited warning, and fail discovery of that
path. The second pass checks again before it allocates any HopID.

Add a KUnit test that discovers paths from a router stub reporting
adapter max_port_number + 1 and 63, a valid adapter on the first read
and an invalid one on the second, and the same for the source HopID
lookup, and checks that no HopID stays allocated.

Signed-off-by: Dj <[email protected]>
@DjDeveloperr

DjDeveloperr commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Verdict at c03c53f31c7a: ready (code); the J714s and J773g dock rows listed under "Not yet" are still owed before merge

Blockers: none. My first-pass blocker (a crash when the second read of path discovery ends the path early) is fixed: tb_path_discover() now does if (!p) goto err; at the top of the second pass (drivers/thunderbolt/path.c:190). tb_test_path_discover_shorter is the case I described, and the err path gives back the HopIDs already taken.

Checked

  • New in property.c: tb_property_parse_dir() refuses a block shorter than the 2-dword root directory header (249) before reading magic and length. That matters now that the XDomain request can hand it a 1-dword block. tb_test_property_parse_short_block covers it.
  • DROM (eeprom.c):
    • The entry loop needs both header bytes, and an entry length from the header size up to the bytes left, so len - 2 can no longer underflow into kstrndup().
    • tb_drom_parse() checks the 16-byte USB4 header before reading the revision and length, and checks the 22-byte header before the v1 parser.
    • The product descriptor is bounded with offsetofend(…, idProduct).
  • DP bandwidth (tb.c): ev->port > max_port_number is refused before sw->ports[ev->port], and goto put_sw drops the router reference.
  • XDomain (xdomain.c): a zero data_length fails on the first response. Any response that passes the existing length check carries at least the three dwords of the XDomain header's size as data, so each round moves req.offset forward and the loop ends.
  • tb_path_find_dst_port() keeps port && in its loop condition, so a NULL remote there just ends the walk. The two new uses of tb_path_hop_out_port() before allocation are right.
  • The test hooks (KUNIT_STATIC_STUB_REDIRECT in tb_cfg_request_sync(), VISIBLE_IF_KUNIT on tb_xdp_properties_request(), declared under CONFIG_KUNIT) do nothing unless a KUnit test turns them on. No runtime switches and no board gates.
Evidence
  • kunit.py run --arch=arm64 --make_options LLVM=1 with KUNIT=y PCI=y USB4=y USB4_KUNIT_TEST=y KASAN=y KASAN_GENERIC=y, 'thunderbolt.*', at c03c53f31c7a: 81/81 passed, no KASAN report. That includes tb_test_path_discover_shorter and tb_test_property_parse_short_block.
  • make W=1 drivers/thunderbolt/{path,property}.o (asahi profile, LLVM=1, arm64): no warnings. Earlier: {path,eeprom,tb,xdomain,ctl}.o clean at 4c3ae6ca3418. checkpatch.pl --strict on the two new commits: clean.

@DjDeveloperr

DjDeveloperr commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Final row at c03c53f31c7a: PASS (no dock or USB4 peer attached). Since 4c3ae6ca3418, path.c, property.c and test.c changed.

How it was run: one guarded one-shot of main 255761f1d55f plus this PR, plus #3193 and #3227. This PR's 8 files are identical to its head, and no files overlap.

  • path goes out of non-existent adapter: 0.
  • Thunderbolt, XDomain or USB4 lines matching error|invalid|fail|refus|short: 0.
  • DROM 0, Device is not trusted 0, KASAN/Oops 0.
  • No USB4 peer is cabled, so there's no XDomain property block to read.
  • One RTC s2idle: success +1, same boot, 0 failed units.
  • Wi-Fi on PCIe: 0 rx errors, and 0 pcie-apple error lines.
  • 0 WARNING: lines. The error-level lines are the same set as on the next boot of the same main without TB changes.

The Mac went back to the stock kernel, and the kit was removed from it.


Earlier, at 4c3ae6ca3418:

J773g (M4 Mac mini) at 4c3ae6ca3418: PASS as no-regression evidence (no dock attached). Your next head, with the runtime NULL check for a router that names an unconnected adapter, gets its own row in my next combined boot.

How it was run: two guarded one-shots on the default cmdline, the same day on the same Mac. Both returned to the stock kernel afterwards, and the kits were removed from the Mac.

No USB4/Thunderbolt device is attached to this Mac, so this is a smoke check: no new kernel lines, PCIe and Wi-Fi unaffected, and one s2idle cycle survived. It doesn't exercise a dock.

control (main) candidate
boot 0 kernel bugs, 0 WARNING: lines, 0 failed units same
thunderbolt devices none none
path goes out of non-existent adapter 0 0
DROM, Device is not trusted, xdomain released for the sleep 0 / 0 / 0 0 / 0 / 0
swiotlb buffer is full, bounce buffers are inactive, KASAN, Oops 0 / 0 / 0 / 0 0 / 0 / 0 / 0
pcie-apple / PCIe-C error lines 0 0
Wi-Fi (BCM4388 on PCIe, bidirectional receive DMA) 4 × 200 MB each way, 0 rx errors same, 0 rx errors
RTC s2idle (12 s) success +1, same boot, Wi-Fi reconnected, 0 failed units same

The only extra err-level kernel lines on the candidate are the scaler module A/B's two job timeouts (#3217). They aren't TB/PCI lines.

tb_path_discover() counts a path's hops in a first pass and reads the
hop entries again in a second one, following each out adapter's link
to the next router. On the second read a router can name another
adapter that is in range but has no link. The next adapter is then
NULL, and the following iteration reads its hop entry through it.

Fail discovery when the second pass runs out of adapters before the
hops counted in the first one. The error path gives back the HopIDs
already allocated for the earlier hops.

Extend the KUnit test with a path through a device router that, read
again, leaves the host through its unlinked adapter 3 instead.

Signed-off-by: DjDeveloperr <[email protected]>
tb_property_parse_dir() reads the root directory's magic and length,
the first two dwords of the block, before it looks at the block's
length. An XDomain peer chooses that length, and the properties
request allocates exactly the dwords it reports, so a one-dword block
holding the root magic makes the parser read past the allocation.

Refuse a block shorter than the root directory header, and add a KUnit
test for blocks of zero and one dword.

Signed-off-by: DjDeveloperr <[email protected]>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor

Reviewed at c03c53f31c7a. The DROM entry/header/product-descriptor checks, DP bandwidth adapter bounds check, XDomain empty-block check, and root-directory header length check all look solid.

Two small issues in drivers/thunderbolt/path.c:

  1. tb_path_hop_out_port() allows hop->out_port == 0 (the control adapter, never a valid egress adapter for a data path hop). tb_switch_alloc() (drivers/thunderbolt/switch.c:2535, and alloc_switch() in test.c:87) skips ida_init() on sw->ports[0], so when alloc_hopid is true, tb_port_alloc_out_hopid(&sw->ports[0], ...) calls ida_alloc_range(), which takes xas_lock_irqsave() (lib/idr.c:397) before checking min > max — hitting spinlock/lockdep bugs on the uninitialized ida. When alloc_hopid is false (e.g. resume discovery), tb_path_discover() succeeds and returns &sw->ports[0] as out_port / tunnel->dst_port. Checking if (!hop->out_port || hop->out_port > sw->config.max_port_number) in tb_path_hop_out_port() (plus an out_port = 0 KUnit case) closes both.
  2. In the second pass of tb_path_discover(), hop.enable is not re-checked after tb_port_read(). Since __tb_path_deactivate_hop() clears only hop.enable while leaving out_port/next_hop intact, a hop disabled between the two reads still allocates HopIDs and returns an active path (or hits out_port == 0 if zeroed). Adding if (!hop.enable) goto err; right after tb_port_read() closes that re-read race alongside if (!p) goto err;.

(Minor pre-existing note in eeprom.c: usb4_copy_drom() and tb_drom_copy_nvm() add 13 to the unmasked u16 *size read at offset 14, so a router reporting 0xfff3 wraps *size to 0, allocating ZERO_SIZE_PTR and running one dwords = 0 iteration of tb_nvm_read_data() before tb_drom_parse() rejects size < 16.)

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

J714s (MacBook Pro 14" M5 Pro, T6050) row at c03c53f31c7a: PASS for what this Mac can exercise.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at c03c53f3

Blockers:

  1. drivers/thunderbolt/path.c:130: tb_path_hop_out_port() checks hop->out_port > sw->config.max_port_number but allows hop->out_port == 0 (the control adapter, never a valid egress adapter for a data path hop). tb_switch_alloc() skips ida_init() on sw->ports[0], so with alloc_hopid == true, tb_port_alloc_out_hopid(&sw->ports[0], ...) touches an uninitialized ida; with alloc_hopid == false, tb_path_discover() can return &sw->ports[0] as dst_port. Reject hop->out_port == 0 (if (!hop->out_port || hop->out_port > sw->config.max_port_number)) and add a KUnit case for out_port == 0.
  2. drivers/thunderbolt/path.c:204-213: in the second pass of tb_path_discover(), re-check if (!hop.enable) goto err; after tb_port_read() so a hop disabled between the two passes does not allocate HopIDs or return an active path.
  3. Rerun the 18 cancelled CI checks once the above fixes are pushed.

Checked:

  • drivers/thunderbolt/eeprom.c: DROM entry header/length bounds, product descriptor offsetofend(..., idProduct) check, and 16-byte USB4 / 22-byte v1 header checks are solid.
  • drivers/thunderbolt/tb.c:3664: DP bandwidth request ev->port > sw->config.max_port_number check properly drops the router reference via goto put_sw.
  • drivers/thunderbolt/property.c:249 and xdomain.c: root directory header length check and zero-length XDomain properties check are solid.
Evidence
  • Diff reviewed at c03c53f3: ctl.c, eeprom.c, path.c, property.c, tb.c, tb.h, test.c, xdomain.c.
  • Matches the two path.c bugs also identified in earlier review comments at c03c53f3.

tb_path_hop_out_port() accepted out_port 0, the control adapter. No
tunnel path leaves through it, and its port has no HopID ida set up, so
discovery could allocate HopIDs on an uninitialised ida or return the
control adapter as the path end. Refuse it like a non-existent adapter.

The second pass of tb_path_discover() re-reads each hop but did not check
that it is still enabled, so a hop disabled between the passes was used
as a live one. Fail discovery instead.

Add KUnit cases for both.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Pushed 69399d9 on top with the two path.c fixes from the review: tb_path_hop_out_port() now refuses out_port 0 (the control adapter has no HopID ida and never carries a tunnel), and the second pass of tb_path_discover() fails if a hop was disabled since the first pass.
New KUnit cases tb_test_path_discover_out_port_zero and tb_test_path_discover_hop_disabled; the thunderbolt KUnit suite passes locally (x86_64 QEMU, 83/83).
Still needed: CI on the new head, App re-review, and one docked row (J714s or J773g with a USB4 dock, DP tunnel and an XDomain peer if available) at 69399d9.
Thanks @DjDeveloperr for the series.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 69399d99 — code is clean and both drivers/thunderbolt/path.c blockers from c03c53f3 are resolved; awaiting exact-head CI and the docked hardware row at 69399d99.

Blockers:

  1. Exact-head CI and one docked USB4 hardware row at 69399d99 (J714s or J773g with USB4 dock attach/detach, DP tunnel, dock I/O, and deep sleep, plus an XDomain peer if available) have not been posted yet.

Checked: Full 8-file diff (drivers/thunderbolt/{ctl.c,eeprom.c,path.c,property.c,tb.c,tb.h,test.c,xdomain.c}), delta commit 69399d99e5, HopID cleanup ordering in tb_path_discover(), and the two new KUnit cases (tb_test_path_discover_out_port_zero, tb_test_path_discover_hop_disabled).

Evidence
  • Prior path.c blockers resolved (69399d99e5):
    • drivers/thunderbolt/path.c:131: tb_path_hop_out_port() now rejects !hop->out_port || hop->out_port > sw->config.max_port_number, preventing adapter 0 (control adapter, uninitialized HopID ida) from ever being used or returned as dst_port.
    • drivers/thunderbolt/path.c:211-213: the second pass of tb_path_discover() now checks if (!hop.enable) goto err; before looking up out_port or allocating HopIDs, rolling back any HopIDs allocated on earlier hops.
    • drivers/thunderbolt/test.c:744-783: adds tb_test_path_discover_out_port_zero (first-read and second-read adapter 0) and tb_test_path_discover_hop_disabled (hop disabled between passes), both verifying no HopIDs leak (83/83 thunderbolt KUnit pass reported locally in QEMU).
  • Earlier hardening commits intact: DROM header/entry/product-descriptor bounds (eeprom.c), DP bandwidth request adapter bounds (tb.c), XDomain empty properties block rejection (xdomain.c), and rootdir header length guard (property.c) are unchanged and clean. All commits carry valid human Signed-off-by lines.
  • Remaining merge gate: Once CI passes and the exact-head docked hardware row lands at 69399d99, this is ready to approve and merge.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 29, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

I merged current main into this branch (70d4557c, normal push, no rebase, your commits unchanged). The last CI failures came from main itself on 11-29: the apple-scaler-recovery and g17-compute-owed-stamp fixtures, plus the apple-dcp harness break fixed in #3672. Re-running a job would reuse the old merge commit, so a fresh merge was the only way to clear them. Both merges were conflict-free. Host tests pass on the merged tree. The PR's own code is unchanged from 69399d99, so the existing hardware rows still cover it. Next: CI at this head and the review app's verdict.

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at 70d4557c.

Checked: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks and the docked USB4 attach/detach, DP tunnel, dock I/O and suspend row.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 70d4557cbb62

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: Compared the PR patch before and after the forward merge. The file set and added and removed lines match the reviewed revision. Keep hosted checks and the docked USB4 attach/detach, DP tunnel, dock I/O and suspend row.

Follow-ups (not blocking): hosted checks; docked USB4 attach/detach, DP tunnel, suspend row

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at 70d4557cbb62 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot]. Row: the hardware row at 70d4557 that the readiness check found (PR body or comment). CI: linux train L3 = main 429e7e1 + 28 approved PRs (candidate 45c2fa4b): Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit dcp-fabric/dcp-topology/dcp-display/macsmc/spi-hid-apple/mt7932/asahi/sep pass; ave failed to build only because of #3153 (unused static helper under -Werror; #3153 held out) and passes with #3153 reverted from the candidate; host tests apple-dcp and apple-scaler-recovery pass. The rest of the hosted run is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit 3706b76 into main Dec 1, 2026
21 of 43 checks passed
@RyanTheTide
RyanTheTide deleted the fix/tb-drom-dpbw-xdomain branch December 1, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants