]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: ump: Don't open legacy substream for an inactive group
authorTakashi Iwai <tiwai@suse.de>
Fri, 29 Nov 2024 09:45:42 +0000 (10:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Jan 2025 09:34:17 +0000 (10:34 +0100)
[ Upstream commit 3978d53df7236f0a517c2abeb43ddf6ac162cdd8 ]

When a UMP Group is inactive, we shouldn't allow users to access it
via the legacy MIDI access.  Add the group active flag check and
return -ENODEV if it's inactive.

Link: https://patch.msgid.link/20241129094546.32119-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/core/ump.c

index 8d37f237f83b2e3949cbbc856a8168622a0b8955..0ade67d6b0896e79795348d6b6292cb646f1d2da 100644 (file)
@@ -1087,6 +1087,8 @@ static int snd_ump_legacy_open(struct snd_rawmidi_substream *substream)
        guard(mutex)(&ump->open_mutex);
        if (ump->legacy_substreams[dir][group])
                return -EBUSY;
+       if (!ump->groups[group].active)
+               return -ENODEV;
        if (dir == SNDRV_RAWMIDI_STREAM_OUTPUT) {
                if (!ump->legacy_out_opens) {
                        err = snd_rawmidi_kernel_open(&ump->core, 0,