AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 44 Bitcoin

usb: don't hold the callback mutex during the callback

Public commit record

What the developer wrote

Authored by Jon Griffiths

73/100 · Adequate
usb: don't hold the callback mutex during the callback

Note that the callback is called via trigger_event() from a single thread
only and so holding the mutex while calling it is pointless. If the callback
triggers code which attempts to unset the callback (for example, during error
handling), then this will deadlock.

Instead, use the mutex only to protect reading and writing the callback and
context variables themselves.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a potential deadlock in the Blockstream Jade hardware wallet's USB mass-storage code. Previously, a protective lock was held while calling a user-provided callback function. If that callback tried to unregister itself (for example, during error handling), it would wait forever for the lock that was already held, freezing the USB task. The fix copies the callback details under the lock, releases the lock, and only then invokes the callback. It is a reliability and availability fix, not a direct theft-of-funds bug, but deadlocks in a hardware wallet's USB path can affect device responsiveness and error recovery.

Recommended action

Treat as a low-to-moderate reliability/security fix. Review whether any other callback dispatch sites in the codebase hold locks across callbacks. No immediate emergency response is warranted, but the patch should be included in the next firmware release and regression-tested for USB attach/detach and error-handling paths.

Security signals we found

01

Deadlock in callback dispatch path

02

Mutex held across user-supplied callback invocation

03

Reentrancy hazard in USB mass-storage event handling

04

Potential denial-of-service via unresponsive USB task

05

Fix narrows critical section and copies callback state before invocation

Risk score

Why this scored 44/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 7/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.