Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3546511pxj; Mon, 24 May 2021 09:05:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0+m2GbRu93Rguyn9zNKV7MUtuUTx3FiBtZWki7KsaGoKOKDpXP2IniIgs8+gcKlBSvIac X-Received: by 2002:a17:907:2148:: with SMTP id rk8mr24251237ejb.270.1621872357598; Mon, 24 May 2021 09:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872357; cv=none; d=google.com; s=arc-20160816; b=IgrORomI/rbPghv3nhX6M+CzsrqOINF/FSzd4lOFu0ElpxtBpOlIuM2SPqd0KfA7q4 NOPansmoMLqOjOdNtMVM3FADP+IgbEzs/b68MYRKTtlGkh4MyOSwAcrTxRZ2tIAEUa2M IjMcnF2YMdPYqvT1iBizPyt2f3WU3JfKHih4Gj+iLAoayK9kgiyxtXRANtLu07HDgX9d 66RZ1ynHP/xusVx5rxERQVQfOONQxJfrG7N7t4HpxFVsYSastrzsyJwML/qJWE4gpfDg pXa8Nh2FCV9R0MEWKm3oDiYGAJFVwXjv/YCNzzr0F1aApNlEyXwvU+VDnE1k1DEsrMiA zTqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1kvRnwR4frZBVSSQBGiPhP3GpMVmXQ4yZMED1nzHTgs=; b=QEPGhyvkfTvfsGCWAoMJXACwypULowyJ1wc1QT8CHODQpm8iQAfo3oWh+8LOTi8MSj 4fz0SvT5XBg6BQX/2uhObXDU7Uvex/gG11QPKluQKtDH0zqQfU5vO7YjwZKrFSnF7vd3 06UxUHh8gf0MTrLn3Est+safozKLYrUbFcpaBh5cZg0+eTPf1wkuB3RC/Xujidn5JfKz EI/shDffu4iZIZWt0FgQieZzfJn0r3EEmL4VRA5++T+s8QN2IEzc++YwvvbZuntC7OPa qX9Spt1BY7B3M+pAfjQuFm6qjDMFX8k4Y/1a9o/Av6jfEGdVsjMcUCrthO/k2GKt/xlE K4mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wNfXws2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si11673505ejy.298.2021.05.24.09.05.28; Mon, 24 May 2021 09:05:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wNfXws2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237496AbhEXQFZ (ORCPT + 99 others); Mon, 24 May 2021 12:05:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:41116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235623AbhEXP6w (ORCPT ); Mon, 24 May 2021 11:58:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAC7261975; Mon, 24 May 2021 15:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871081; bh=zcj1N2YsNW4jSa0/pwPpHGaac4BQZlaVdlLqA796S/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wNfXws2ge6LNSKQozFpgUlBvqldqUtRT2YDsAo64rg9TXBjQ9MY+6T1r+sGAikVj5 S+854vhxwWWvGYvDqvE+lpB8G14Qzoj8uJhJkrRpk22q7TkIZfba5ESltE1x1p7i26 Xh+Oryo2wDaJ4y+XprlY6KjY4/q+yhZya4KgsSD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai Subject: [PATCH 5.12 052/127] ALSA: firewire-lib: fix check for the size of isochronous packet payload Date: Mon, 24 May 2021 17:26:09 +0200 Message-Id: <20210524152336.601810437@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Sakamoto commit 395f41e2cdac63e7581fb9574e5ac0f02556e34a upstream. The check for size of isochronous packet payload just cares of the size of IR context payload without the size of CIP header. Cc: Fixes: f11453c7cc01 ("ALSA: firewire-lib: use 16 bytes IR context header to separate CIP header") Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20210513125652.110249-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/amdtp-stream.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -633,18 +633,24 @@ static int parse_ir_ctx_header(struct am unsigned int *syt, unsigned int packet_index, unsigned int index) { const __be32 *cip_header; + unsigned int cip_header_size; int err; *payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT; - if (*payload_length > s->ctx_data.tx.ctx_header_size + - s->ctx_data.tx.max_ctx_payload_length) { + + if (!(s->flags & CIP_NO_HEADER)) + cip_header_size = 8; + else + cip_header_size = 0; + + if (*payload_length > cip_header_size + s->ctx_data.tx.max_ctx_payload_length) { dev_err(&s->unit->device, "Detect jumbo payload: %04x %04x\n", - *payload_length, s->ctx_data.tx.max_ctx_payload_length); + *payload_length, cip_header_size + s->ctx_data.tx.max_ctx_payload_length); return -EIO; } - if (!(s->flags & CIP_NO_HEADER)) { + if (cip_header_size > 0) { cip_header = ctx_header + 2; err = check_cip_header(s, cip_header, *payload_length, data_blocks, data_block_counter, syt);