From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH 1/3] ALSA: ump: Don't open legacy substream for an inactive group
Date: Fri, 29 Nov 2024 10:45:42 +0100 [thread overview]
Message-ID: <20241129094546.32119-2-tiwai@suse.de> (raw)
In-Reply-To: <20241129094546.32119-1-tiwai@suse.de>
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 --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,
--
2.43.0
next prev parent reply other threads:[~2024-11-29 9:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 9:45 [PATCH 0/3] ALSA: ump: Fixes for legacy rawmidi handling Takashi Iwai
2024-11-29 9:45 ` Takashi Iwai [this message]
2024-11-29 9:45 ` [PATCH 2/3] ALSA: ump: Indicate the inactive group in legacy substream names Takashi Iwai
2024-11-29 9:45 ` [PATCH 3/3] ALSA: ump: Update legacy substream names upon FB info update Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241129094546.32119-2-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-sound@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox