max3421: a control transfer submitted right after a control timeout overwrites the pending abort
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- backend-api-design, embedded-iot
Direzione di ricerca
Start with src/host/usbh.c and hcd_max3421.c, tracing the control timeout, abort, and setup paths cited in the issue. Check how EP0 state and busy_lock behave when a new transfer is submitted before HXFRDN retires the abort. The fix should prevent the replacement SETUP from being lost or a late completion from advancing the replacement; the proposed HIL case on metro_m4_express could confirm this.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Greptile raised this in adafruit/Adafruit_TinyUSB_Arduino#615, the vendored sync of d543126c5. I checked it against
26adc208a (src/host/usbh.c and hcd_max3421.c are unchanged on current master).
Related: #4070 lists max3421 as aborting an active transfer, which this contradicts. #4472 plans HIL abort tests.
Trigger
On a MAX3421 host, a device NAKs a control stage for longer than CFG_TUH_CONTROL_TIMEOUT_MS. A new control transfer
to the same address is then submitted before the next HXFRDN, either from the TIMEOUT complete_cb or by
control_xfer_dispatch_pending() on the next loop pass.
Causal path
usbh.c:2433-2434:control_xfer_timeout_expired()callshcd_edpt_abort_xfer(), then
control_xfer_complete(TIMEOUT)straight away. That sets the slot IDLE and calls the callback (:1200-1203). A
resubmit reacheshcd_setup_send()at:1102, or at:1172through the dispatch at:913-915.hcd_max3421.c:765-768: the abort only setsEP_STATE_ABORTING, which takes effect on the next NAK
(:901-903).hcd_max3421.c:781-799:hcd_setup_send()overwrites the shared EP0 entry withEP_STATE_ATTEMPT_1. The NAK loop
still holdsbusy_lock, so no SETUP is launched.hcd_max3421.c:905-908: the next NAK re-writes the cached_hcd_data.hxfrof the old stage. The MAX3421E
Programming Guide (p10, p56) says every retry is a CPU write of HXFR; the chip has no hardware abort.
Consequence
- The replacement's SETUP never goes on the wire, and while the device keeps NAKing it times out too.
- If the device later ACKs the old IN, RCVDAV (
hcd_max3421.c:1066-1072) writes up to 8 bytes into
_usbh_epbuf.request.usbh_control_xfer_cb()(usbh.c:1216,:1249-1254) treats that completion as the SETUP
and starts the data stage with a corruptedwLengthand direction. - A late zero-length status completion can likewise advance the replacement past a SETUP the device never received.
Fix direction
Keep the slot unavailable until the abort retires, or make hcd_setup_send() defer a new SETUP while EP0 is
EP_STATE_ABORTING and busy_lock is held.
Uncertain
- Not reproduced on hardware.
- The window depends on the gap between the abort and the next HXFRDN. It is wider where the MAX3421 interrupt is
serviced from a task, as in the ESP32 BSP. - The corruption branch needs a device that answers the old IN after the timeout.
- A HIL case with a NAK-forever EP0 fixture on metro_m4_express would confirm it.
- Lingua principale
- C
- Stelle
- 7.3k
- Fork
- 1.6k
- Merge medio
- 1g 19h
- PR unite (30g)
- 67
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hathach/tinyusb
-
follow-up Port WCH USBFS Prio 📌
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
follow-up Prio 📌
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
hil-contract: a background hil_remote.py launch is killed at the Bash default 10 min timeoutForse già presa @hathach l’ha presa 16 giorni fa. Apertafollow-up Prio 📌
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
ch32v30x: debug UART loses queued bytes when its TX ring fillsForse già presa @hathach l’ha presa 16 giorni fa. Apertafollow-up Prio 📌
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
followup Prio 📌
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di hathach/tinyusb
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
rofl0r/proxychains-ng#631 ·
-
RP2350: enabling secure boot via rescue fails with 6400 (BOOTKEY written as 33 bytes in ECC mode)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
pcqpcq/open-source-android-apps#619 ·
I maintainer di solito rispondono entro 1 giorno
-
Can't link with minizip-ngAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
-
Missing slice offset check in jvp_equal fast path corrupts slice comparison and aborts delpathsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni