diff mbox series

[22/36] ALSA: seq: Prohibit creating ports with special numbers

Message ID 20230519093114.28813-23-tiwai@suse.de (mailing list archive)
State Superseded
Headers show
Series ALSA: Add MIDI 2.0 support | expand

Commit Message

Takashi Iwai May 19, 2023, 9:31 a.m. UTC
Some port numbers are special, such as 254 for subscribers and 255 for
broadcast.  Return error if application tries to create such a port.

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

Comments

Jaroslav Kysela May 22, 2023, 7:15 a.m. UTC | #1
On 19. 05. 23 11:31, Takashi Iwai wrote:
> Some port numbers are special, such as 254 for subscribers and 255 for
> broadcast.  Return error if application tries to create such a port.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
diff mbox series

Patch

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 2dac8c3355fd..0f26f20596d7 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1206,6 +1206,8 @@  static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg)
 		port_idx = info->addr.port;
 	else
 		port_idx = -1;
+	if (port_idx >= SNDRV_SEQ_ADDRESS_UNKNOWN)
+		return -EINVAL;
 	err = snd_seq_create_port(client, port_idx, &port);
 	if (err < 0)
 		return err;