[PATCH 1/2] ALSA: firewire-lib: Rearm the FCP transaction after a bus reset

From: Suyuan Wang via B4 Relay

Date: Fri Nov 20 2026 - 00:38:13 EST


From: Suyuan Wang <stevewong@xxxxxxxxxxx>

When a bus reset happens while fcp_avc_transaction() waits for a
response, fcp_bus_reset() moves the transaction to STATE_BUS_RESET and
wakes the waiter, which sleeps and then sends the command again.
Nothing sets the state back to STATE_PENDING, though:

wait_event_timeout(t.wait, t.state != STATE_PENDING, ...);
...
} else if (t.state == STATE_BUS_RESET) {
msleep(ERROR_DELAY_MS);
}

fcp_response() only accepts a response for a transaction in
STATE_PENDING, so the response to the resent command is ignored, and
wait_event_timeout() returns at once because the state is still
STATE_BUS_RESET. The loop then resends the command every
ERROR_DELAY_MS without counting tries, and the caller never returns
unless sending the command itself fails.

Set the state back to STATE_PENDING before resending, as the
STATE_DEFERRED branch already does.

Found with a static analysis tool and checked by hand.

Fixes: 31ef9134eb52 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
Signed-off-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
Signed-off-by: Suyuan Wang <stevewong@xxxxxxxxxxx>
---
sound/firewire/fcp.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/sound/firewire/fcp.c b/sound/firewire/fcp.c
index e60bfd0ee4ac..d733f6123baa 100644
--- a/sound/firewire/fcp.c
+++ b/sound/firewire/fcp.c
@@ -273,6 +273,8 @@ int fcp_avc_transaction(struct fw_unit *unit,
break;
} else if (t.state == STATE_BUS_RESET) {
msleep(ERROR_DELAY_MS);
+ /* resend the command and wait for its response again */
+ t.state = STATE_PENDING;
} else if (++tries >= ERROR_RETRIES) {
dev_err(&t.unit->device, "FCP command timed out\n");
ret = -EIO;

--
2.34.1