Skip to content

Commit 395f41e

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-lib: fix check for the size of isochronous packet payload
The check for size of isochronous packet payload just cares of the size of IR context payload without the size of CIP header. Cc: <[email protected]> Fixes: f11453c ("ALSA: firewire-lib: use 16 bytes IR context header to separate CIP header") Signed-off-by: Takashi Sakamoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 0edabdf commit 395f41e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sound/firewire/amdtp-stream.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,18 +633,24 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
633633
unsigned int *syt, unsigned int index)
634634
{
635635
const __be32 *cip_header;
636+
unsigned int cip_header_size;
636637
int err;
637638

638639
*payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT;
639-
if (*payload_length > s->ctx_data.tx.ctx_header_size +
640-
s->ctx_data.tx.max_ctx_payload_length) {
640+
641+
if (!(s->flags & CIP_NO_HEADER))
642+
cip_header_size = 8;
643+
else
644+
cip_header_size = 0;
645+
646+
if (*payload_length > cip_header_size + s->ctx_data.tx.max_ctx_payload_length) {
641647
dev_err(&s->unit->device,
642648
"Detect jumbo payload: %04x %04x\n",
643-
*payload_length, s->ctx_data.tx.max_ctx_payload_length);
649+
*payload_length, cip_header_size + s->ctx_data.tx.max_ctx_payload_length);
644650
return -EIO;
645651
}
646652

647-
if (!(s->flags & CIP_NO_HEADER)) {
653+
if (cip_header_size > 0) {
648654
cip_header = ctx_header + 2;
649655
err = check_cip_header(s, cip_header, *payload_length,
650656
data_blocks, data_block_counter, syt);

0 commit comments

Comments
 (0)