[PATCH v2 1/2] ALSA: firewire-lib: Abort the FCP transaction on a bus reset
From: Suyuan Wang via B4 Relay
Date: Sun Nov 22 2026 - 08:46:40 EST
From: Suyuan Wang <stevewong@xxxxxxxxxxx>
When fcp_bus_reset() marks a transaction as STATE_BUS_RESET,
fcp_avc_transaction() sleeps and resends the command, but leaves the
state as it is. The response to the resent command is then ignored, and
the next wait returns at once, so the loop keeps resending the command
without a retry limit until sending fails.
The AV/C Digital Interface Command Set General Specification 4.2 says
that a target which detects a bus reset discards any AV/C transaction
in progress without returning a response. So instead of resending, end
the transaction on a bus reset and return -EAGAIN, so that the caller
can start the sequence again. ERROR_DELAY_MS and <linux/delay.h> have no
users left after this, so drop them.
Found with a static analysis tool and checked by hand.
Suggested-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
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 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/firewire/fcp.c b/sound/firewire/fcp.c
index e60bfd0ee4ac..b8e7e2c90791 100644
--- a/sound/firewire/fcp.c
+++ b/sound/firewire/fcp.c
@@ -14,7 +14,6 @@
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
-#include <linux/delay.h>
#include "fcp.h"
#include "lib.h"
#include "amdtp-stream.h"
@@ -22,7 +21,6 @@
#define CTS_AVC 0x00
#define ERROR_RETRIES 3
-#define ERROR_DELAY_MS 5
#define FCP_TIMEOUT_MS 125
int avc_general_set_sig_fmt(struct fw_unit *unit, unsigned int rate,
@@ -272,7 +270,8 @@ int fcp_avc_transaction(struct fw_unit *unit,
ret = t.response_size;
break;
} else if (t.state == STATE_BUS_RESET) {
- msleep(ERROR_DELAY_MS);
+ ret = -EAGAIN;
+ break;
} else if (++tries >= ERROR_RETRIES) {
dev_err(&t.unit->device, "FCP command timed out\n");
ret = -EIO;
--
2.34.1