Commit 243ac474 authored by Takashi Iwai's avatar Takashi Iwai Committed by Wen Zhiwei
Browse files

ALSA: ump: Don't open legacy substream for an inactive group

stable inclusion
from stable-v6.6.70
commit cf29cbf61cf2d914d4877b5e09c47cb19e744e3d
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBOHV1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=cf29cbf61cf2d914d4877b5e09c47cb19e744e3d

--------------------------------

[ 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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 4f3c26c9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1081,6 +1081,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,