diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-08-14 21:27:51 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-08-14 22:50:52 +0200 |
commit | 82fd4b05d704623a0e4aa7fda48e272a9889337d (patch) | |
tree | 711f3d02a97fcfb7231193c85b49a976aa07b5a1 /sound | |
parent | Merge tag 'asoc-v4.19' of https://git.kernel.org/pub/scm/linux/kernel/git/bro... (diff) | |
download | linux-82fd4b05d704623a0e4aa7fda48e272a9889337d.tar.xz linux-82fd4b05d704623a0e4aa7fda48e272a9889337d.zip |
ALSA: seq: virmidi: Fix discarding the unsubscribed output
The recent change to move the virmidi output processing to a work
slightly modified the code to discard the unsubscribed outputs so that
it works without a temporary buffer. However, this is actually buggy,
and may spew a kernel warning due to the unexpected call of
snd_rawmidi_transmit_ack(), as triggered by syzbot.
This patch takes back to the original code in that part, use a
temporary buffer and simply repeat snd_rawmidi_transmit(), in order to
address the regression.
Fixes: f7debfe54090 ("ALSA: seq: virmidi: Offload the output event processing")
Reported-by: syzbot+ec5f605c91812d200367@syzkaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/seq/seq_virmidi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index a2f1c6b58693..cb988efd1ed0 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -149,8 +149,9 @@ static void snd_vmidi_output_work(struct work_struct *work) /* discard the outputs in dispatch mode unless subscribed */ if (vmidi->seq_mode == SNDRV_VIRMIDI_SEQ_DISPATCH && !(vmidi->rdev->flags & SNDRV_VIRMIDI_SUBSCRIBE)) { - while (!snd_rawmidi_transmit_empty(substream)) - snd_rawmidi_transmit_ack(substream, 1); + char buf[32]; + while (snd_rawmidi_transmit(substream, buf, sizeof(buf)) > 0) + ; /* ignored */ return; } |