alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ALSA: seq: Fix running status after receiving sysex
@ 2020-03-16  9:05 Takashi Iwai
  2020-03-16  9:05 ` [PATCH 1/2] ALSA: seq: virmidi: " Takashi Iwai
  2020-03-16  9:05 ` [PATCH 2/2] ALSA: seq: oss: " Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Takashi Iwai @ 2020-03-16  9:05 UTC (permalink / raw)
  To: alsa-devel; +Cc: Andreas Steinmetz

Hi,

here are two small fixes for correcting the behavior of sequencer core
wrt the event decoding after receiving a sysex message.


Takashi

===

Takashi Iwai (2):
  ALSA: seq: virmidi: Fix running status after receiving sysex
  ALSA: seq: oss: Fix running status after receiving sysex

 sound/core/seq/oss/seq_oss_midi.c | 1 +
 sound/core/seq/seq_virmidi.c      | 1 +
 2 files changed, 2 insertions(+)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] ALSA: seq: virmidi: Fix running status after receiving sysex
  2020-03-16  9:05 [PATCH 0/2] ALSA: seq: Fix running status after receiving sysex Takashi Iwai
@ 2020-03-16  9:05 ` Takashi Iwai
  2020-03-16  9:05 ` [PATCH 2/2] ALSA: seq: oss: " Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2020-03-16  9:05 UTC (permalink / raw)
  To: alsa-devel; +Cc: Andreas Steinmetz

The virmidi driver handles sysex event exceptionally in a short-cut
snd_seq_dump_var_event() call, but this missed the reset of the
running status.  As a result, it may lead to an incomplete command
right after the sysex when an event with the same running status was
queued.

Fix it by clearing the running status properly via alling
snd_midi_event_reset_decode() for that code path.

Reported-by: Andreas Steinmetz <ast@domdv.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/3b4a4e0f232b7afbaf0a843f63d0e538e3029bfd.camel@domdv.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/seq/seq_virmidi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 626d87c1539b..77d7037d1476 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -81,6 +81,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,
 			if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
 				continue;
 			snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
+			snd_midi_event_reset_decode(vmidi->parser);
 		} else {
 			len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev);
 			if (len > 0)
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ALSA: seq: oss: Fix running status after receiving sysex
  2020-03-16  9:05 [PATCH 0/2] ALSA: seq: Fix running status after receiving sysex Takashi Iwai
  2020-03-16  9:05 ` [PATCH 1/2] ALSA: seq: virmidi: " Takashi Iwai
@ 2020-03-16  9:05 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2020-03-16  9:05 UTC (permalink / raw)
  To: alsa-devel; +Cc: Andreas Steinmetz

This is a similar bug like the previous case for virmidi: the invalid
running status is kept after receiving a sysex message.

Again the fix is to clear the running status after handling the sysex.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/3b4a4e0f232b7afbaf0a843f63d0e538e3029bfd.camel@domdv.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/seq/oss/seq_oss_midi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index a88c235b2ea3..2ddfe2226651 100644
--- a/sound/core/seq/oss/seq_oss_midi.c
+++ b/sound/core/seq/oss/seq_oss_midi.c
@@ -602,6 +602,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq
 		len = snd_seq_oss_timer_start(dp->timer);
 	if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
 		snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev);
+		snd_midi_event_reset_decode(mdev->coder);
 	} else {
 		len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
 		if (len > 0)
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-16  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16  9:05 [PATCH 0/2] ALSA: seq: Fix running status after receiving sysex Takashi Iwai
2020-03-16  9:05 ` [PATCH 1/2] ALSA: seq: virmidi: " Takashi Iwai
2020-03-16  9:05 ` [PATCH 2/2] ALSA: seq: oss: " Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).