Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3538026pxj; Mon, 24 May 2021 08:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEyxBVLH6MaDdmV1GToKAwt110vGzOrJojcxNIlXCGtjeaKZb/ILhov5ReAtM0TIMvzU2k X-Received: by 2002:a92:d307:: with SMTP id x7mr8560095ila.55.1621871801983; Mon, 24 May 2021 08:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621871801; cv=none; d=google.com; s=arc-20160816; b=nvlh/FpcOnArq0pGUfoJbJLiH19l5Fh+yjul1aIqMUWy1XUQnA+nRjZCejDdVHsPUJ /dB2nz301xtSJR93y9YqX7bnqGIAo7fJvanuhxRI+G39Jdx7s7hueSoepGYts4LVdyeL jPrX1sr1gSlvOGEUbTmOJfF9NmVMOEhsz46E+IyEUudg3WIZy9yBwzpPtHSl7yl81SKZ aqNQCAfdxqYQCej8+Zw6cPDzU+OzZOsAHIqBuC1jyXNZQB+Cth1xmCssisst4duQHDYM 6iqQjFUIrA0OGtWSaltzbPjYJZ6iV35D8+wqx/lg11PJ9UVcMu+zwa8MH1K81km7h2LQ jutg== 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=mlITJD6K5ZarPniI8XcIH2HoAYbfsdeySz+9iSM7dvU=; b=X5FMbV3ryBaGyzLZ/7AO6cOw4uLnu0i60hFlWFwDVor7S2NoPWp+/SgE4S2a/x19W4 mEvMs92lRqfiDt+7aPk2OFYwqBYcDAzPUo1VBqVFHMCZisHBp0OgIO/55zYymt/6y7/K smx8KAoF1ypwIFz/O9cniYhVoIO3w/yaqXHA1ZHWsNGjBRGctbiFxjSxKGxD5PhRa0QJ zrerzUwov6er2tx2OQwD+Q2dy3zzfXdSkbFe2r7cDtyX6pplLezazKy31kdPZwNHNDO5 hZUfB7nsVy0MILzeNMROuHZJos49D7JXx01baKSLwXKjhavaEZ6S3ffrSYJwfBK5beWz APqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IAqeHlS9; 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 a8si15055823ild.38.2021.05.24.08.56.28; Mon, 24 May 2021 08:56:41 -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=IAqeHlS9; 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 S234979AbhEXP5A (ORCPT + 99 others); Mon, 24 May 2021 11:57:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:38642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234858AbhEXPuC (ORCPT ); Mon, 24 May 2021 11:50:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C48AA61585; Mon, 24 May 2021 15:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870684; bh=cm7Tes5q7JSWslAR3+hzlASBI9+ebVmkT1VG5UktXy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAqeHlS9Ivtq2BXXSKe++kIEFZMzY3/iyTBRYIDyEkbL3z+WkiOWgnXROAm8Jn3LF /GnykuEXwnEfc7DAEu0/EGnpxxdVjxClKT88sAaB3rRJbqqkK1pc3dRPIGnHc+dv0k rC/Et4AmIxrNSkqwO+RjJXDr3ulo9bbvrzxhUB8s= 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.4 27/71] ALSA: firewire-lib: fix check for the size of isochronous packet payload Date: Mon, 24 May 2021 17:25:33 +0200 Message-Id: <20210524152327.343017478@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152326.447759938@linuxfoundation.org> References: <20210524152326.447759938@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 @@ -617,18 +617,24 @@ static int parse_ir_ctx_header(struct am unsigned int *syt, 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);