ALSA: seq: Fix incorrect sanity check at snd_seq_oss_synth_cleanup()
authorTakashi Iwai <tiwai@suse.de>
Mon, 25 Jan 2016 10:01:47 +0000 (11:01 +0100)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:11:27 +0000 (13:11 +0000)
commit 599151336638d57b98d92338aa59c048e3a3e97d upstream.

ALSA sequencer OSS emulation code has a sanity check for currently
opened devices, but there is a thinko there, eventually it spews
warnings and skips the operation wrongly like:
  WARNING: CPU: 1 PID: 7573 at sound/core/seq/oss/seq_oss_synth.c:311

Fix this off-by-one error.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/seq/oss/seq_oss_synth.c

index c5b773a1eea9324ec7a1c70a0a7dc926031f87a3..4a09c3085ca42c1f4bcdbfd77acaf3c434c55736 100644 (file)
@@ -310,7 +310,7 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp)
        struct seq_oss_synth *rec;
        struct seq_oss_synthinfo *info;
 
-       if (snd_BUG_ON(dp->max_synthdev >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS))
+       if (snd_BUG_ON(dp->max_synthdev > SNDRV_SEQ_OSS_MAX_SYNTH_DEVS))
                return;
        for (i = 0; i < dp->max_synthdev; i++) {
                info = &dp->synths[i];