[PATCH 2/2] ALSA: fireworks: Rearm the transaction after a bus reset
From: Suyuan Wang via B4 Relay
Date: Fri Nov 20 2026 - 00:38:20 EST
From: Suyuan Wang <stevewong@xxxxxxxxxxx>
snd_efw_transaction_run() has the same problem as fcp_avc_transaction():
after snd_efw_transaction_bus_reset() moves the transaction to
STATE_BUS_RESET, the loop sleeps and resends the command but leaves the
state as it is. The response handler only completes a transaction in
STATE_PENDING, and wait_event_timeout() returns at once on the stale
state, so the command is resent every ERROR_DELAY_MS without counting
tries and the caller never returns unless sending fails.
Set the state back to STATE_PENDING before resending.
Found with a static analysis tool and checked by hand.
Fixes: bde8a8f23bbe ("ALSA: fireworks: Add transaction and some commands")
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/fireworks/fireworks_transaction.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/firewire/fireworks/fireworks_transaction.c b/sound/firewire/fireworks/fireworks_transaction.c
index 5c859773fe06..57aef570ac2d 100644
--- a/sound/firewire/fireworks/fireworks_transaction.c
+++ b/sound/firewire/fireworks/fireworks_transaction.c
@@ -100,6 +100,8 @@ int snd_efw_transaction_run(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, "EFW transaction timed out\n");
ret = -EIO;
--
2.34.1