thunderbolt: Fix lost ring interrupts and an XDomain use-after-free
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | thunderbolt: Do not match XDomain responses to received packetsdrivers/ | +7 | 0 replies | |
| 2/2 | thunderbolt: Flush the ring interrupt status cleardrivers/ | +8 | 1 reply |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Mario Limonciello (AMD) |
|---|---|
| 1/2 | |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] thunderbolt: Fix lost ring interrupts and an XDomain use-after-free
Hi folks,
here are two independent fixes found while running an out-of-tree USB4 service driver between two hosts with AMD Strix Halo USB4 host routers (1022:158d, 1022:158e). The driver exchanges XDomain requests and responses in both directions and moves data over its own rings.
Patch 1 stops tb_xdomain_match() from matching received packets to the requests that tb_xdomain_response() queues. Those requests have no response buffer, and a match after their work has run makes the work run again after the request was freed (refcount underflow in tb_cfg_request_work()).
Patch 2 reads back the NHI after the ring's interrupt status is cleared in ring_msix() on hosts without QUIRK_AUTO_CLEAR_INT. Without the read the posted clear can take effect after the next frame has completed and clear its status too, so that frame raises no interrupt. On these hosts that left an XDomain request unprocessed until the sender timed out (about 75 ms in 3-7% of request/reply exchanges), and data ring completions were lost in the same way.
Each patch says how it was tested and what was not tested. Both apply to the fixes branch (f1ae606eb404) and to 7.3.3. They were built on 7.3.3 with W=1 and add no warnings; they were not built on the fixes branch. The analysis, the fixes and the tests were done with an AI coding assistant.
Sven Neuhaus (2):
thunderbolt: Do not match XDomain responses to received packets
thunderbolt: Flush the ring interrupt status clear
drivers/thunderbolt/nhi.c | 8 ++++++++ drivers/thunderbolt/xdomain.c | 7 +++++++ 2 files changed, 15 insertions(+)
base-commit: f1ae606eb404bca2498b9ad69b923073655556e4
Signature · 1 line
2.47.3