diff mbox series

ALSA: firewire-lib: fix to check cycle continuity

Message ID 20240218033026.72577-1-o-takashi@sakamocchi.jp (mailing list archive)
State Accepted
Commit 77ce96543b03f437c6b45f286d8110db2b6622a3
Headers show
Series ALSA: firewire-lib: fix to check cycle continuity | expand

Commit Message

Takashi Sakamoto Feb. 18, 2024, 3:30 a.m. UTC
The local helper function to compare the given pair of cycle count
evaluates them. If the left value is less than the right value, the
function returns negative value.

If the safe cycle is less than the current cycle, it is the case of
cycle lost. However, it is not currently handled properly.

This commit fixes the bug.

Cc: <stable@vger.kernel.org>
Fixes: 705794c53b00 ("ALSA: firewire-lib: check cycle continuity")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/amdtp-stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Iwai Feb. 19, 2024, 8:26 a.m. UTC | #1
On Sun, 18 Feb 2024 04:30:26 +0100,
Takashi Sakamoto wrote:
> 
> The local helper function to compare the given pair of cycle count
> evaluates them. If the left value is less than the right value, the
> function returns negative value.
> 
> If the safe cycle is less than the current cycle, it is the case of
> cycle lost. However, it is not currently handled properly.
> 
> This commit fixes the bug.
> 
> Cc: <stable@vger.kernel.org>
> Fixes: 705794c53b00 ("ALSA: firewire-lib: check cycle continuity")
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index a13c0b408aad..7be17bca257f 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -951,7 +951,7 @@  static int generate_tx_packet_descs(struct amdtp_stream *s, struct pkt_desc *des
 				// to the reason.
 				unsigned int safe_cycle = increment_ohci_cycle_count(next_cycle,
 								IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES);
-				lost = (compare_ohci_cycle_count(safe_cycle, cycle) > 0);
+				lost = (compare_ohci_cycle_count(safe_cycle, cycle) < 0);
 			}
 			if (lost) {
 				dev_err(&s->unit->device, "Detect discontinuity of cycle: %d %d\n",