diff mbox series

[1/3] ALSA: ump: Don't open legacy substream for an inactive group

Message ID 20241129094546.32119-2-tiwai@suse.de (mailing list archive)
State New
Headers show
Series ALSA: ump: Fixes for legacy rawmidi handling | expand

Commit Message

Takashi Iwai Nov. 29, 2024, 9:45 a.m. UTC
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/ump.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/sound/core/ump.c b/sound/core/ump.c
index 6d0aac6c763f..9f9ad106107f 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -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,