Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6784134ybi; Mon, 8 Jul 2019 08:37:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFBpXeh5Qx4+CqrG+KDajZZkfZ8i48fXtv5tJOe18a/DV+b7QZHxMAOhoyBkcibOFPpFbl X-Received: by 2002:a17:902:6b0c:: with SMTP id o12mr25041837plk.113.1562600231553; Mon, 08 Jul 2019 08:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562600231; cv=none; d=google.com; s=arc-20160816; b=Jn8r0V/3WnrZhHdp82WSHqzLFYhY4kh/lfi2rIFm3jOzGqczmNedzKUeQKzkygVNjl CajBfZcE3yEnC7B7hkzA3gFNWDfE3w/5OeUaHrpHZY5aqmpdXlo+gyuNgGiscYhNRi4e NFYGwWqI9ue0ov7Bnqs/DyazX/MgptYFvdT7rG5OEEoZYrYUKdlmHkqF3PQKEN92qbCQ UZozU4gGJjJbksqegaXEbYdwOI0S5LcBSwVbGNG9VHvObnfSJzPBFdS51yr+gagrakHU cx75cVv8O8Qb1SNuerA3uleuxMDeCi1PjklX6fA9Nr1+3iefXMmoll3xPwNcdEYwlBDS JU1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sXpxu3cn+Z0MWKqS7ni/WLzh/6GM+U9T93WNd3A1T+E=; b=ZClu+jqQnMRx+W/mKBnl+QTHU+AGUZuFXhp+1mB7k7UDh/AS3drSXqgCMBb+nYwhuu 91tPWTwX4yNNSTHUpnUJNuWnw1F8Bx9CAv4OssU/JlhGz39EY1oYXeDZlHJnwQb+Ioz6 CDvK8TDbV6GBsrwXCaWROAy+4tjGsInsiKmP2zcpU44tQ2gpfSZcd5obthuVCQ+AeTzp qsiEugwtWayN53SDV5ztV0kAypsEOWhfwxvPMcZz/zNmpnC92EQqOndhwFPgzALzNI5k pZss3nFcH51Z69psa8uj6dZ6ebkwxKIa3AL2aryxAgj1bU3BJfYKnWtZOCo867IDKGFI 556Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m6+D6u10; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r71si20441918pfc.152.2019.07.08.08.36.56; Mon, 08 Jul 2019 08:37:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m6+D6u10; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732340AbfGHPXO (ORCPT + 99 others); Mon, 8 Jul 2019 11:23:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:50118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388144AbfGHPXL (ORCPT ); Mon, 8 Jul 2019 11:23:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 70E9B204EC; Mon, 8 Jul 2019 15:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599390; bh=fYiUsu4wzAHAeLPGcXP9HexqGaEUj1/KrAmDgh4Lwl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m6+D6u10p2AjlOTDkJ4uvLK7ospfaHpUQM1NkpBYmpyr1uHqmPqgyKYfEt0RWnL9t aFeVj72zRZz4NBXXZqUwe2W5qwipSqAaovw0jmEBzhVyvbb7hcE6oqr7nG65Lngusp Ewfh9mi7Sandru0BsSMw1rTRPtZBJwSSDpmlPAfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai Subject: [PATCH 4.9 089/102] ALSA: firewire-lib/fireworks: fix miss detection of received MIDI messages Date: Mon, 8 Jul 2019 17:13:22 +0200 Message-Id: <20190708150531.071686088@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150525.973820964@linuxfoundation.org> References: <20190708150525.973820964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Sakamoto commit 7fbd1753b64eafe21cf842348a40a691d0dee440 upstream. In IEC 61883-6, 8 MIDI data streams are multiplexed into single MIDI conformant data channel. The index of stream is calculated by modulo 8 of the value of data block counter. In fireworks, the value of data block counter in CIP header has a quirk with firmware version v5.0.0, v5.7.3 and v5.8.0. This brings ALSA IEC 61883-1/6 packet streaming engine to miss detection of MIDI messages. This commit fixes the miss detection to modify the value of data block counter for the modulo calculation. For maintainers, this bug exists since a commit 18f5ed365d3f ("ALSA: fireworks/firewire-lib: add support for recent firmware quirk") in Linux kernel v4.2. There're many changes since the commit. This fix can be backported to Linux kernel v4.4 or later. I tagged a base commit to the backport for your convenience. Besides, my work for Linux kernel v5.3 brings heavy code refactoring and some structure members are renamed in 'sound/firewire/amdtp-stream.h'. The content of this patch brings conflict when merging -rc tree with this patch and the latest tree. I request maintainers to solve the conflict to replace 'tx_first_dbc' with 'ctx_data.tx.first_dbc'. Fixes: df075feefbd3 ("ALSA: firewire-lib: complete AM824 data block processing layer") Cc: # v4.4+ Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/amdtp-am824.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/firewire/amdtp-am824.c +++ b/sound/firewire/amdtp-am824.c @@ -388,7 +388,7 @@ static void read_midi_messages(struct am u8 *b; for (f = 0; f < frames; f++) { - port = (s->data_block_counter + f) % 8; + port = (8 - s->tx_first_dbc + s->data_block_counter + f) % 8; b = (u8 *)&buffer[p->midi_position]; len = b[0] - 0x80;