* [PATCH] ALSA: core: Validate device type for dynamic minors
@ 2026-11-04 15:52 Sreeraj S Kurup
2026-11-05 7:49 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Sreeraj S Kurup @ 2026-11-04 15:52 UTC (permalink / raw)
To: perex, tiwai, tiwai; +Cc: linux-sound, linux-kernel, Sreeraj S Kurup
Reject unsupported device types when allocating dynamic minors.
This prevents invalid device types from being registered and
avoids unnecessarily consuming available minor numbers.
Return -EINVAL for unsupported device types.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
sound/core/sound.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 24f40763a20c..32637c40df05 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -184,6 +184,18 @@ static int snd_find_free_minor(int type, struct snd_card *card, int dev)
if (type == SNDRV_DEVICE_TYPE_TIMER)
return SNDRV_MINOR_TIMER;
+ switch (type) {
+ case SNDRV_DEVICE_TYPE_CONTROL:
+ case SNDRV_DEVICE_TYPE_HWDEP:
+ case SNDRV_DEVICE_TYPE_RAWMIDI:
+ case SNDRV_DEVICE_TYPE_PCM_PLAYBACK:
+ case SNDRV_DEVICE_TYPE_PCM_CAPTURE:
+ case SNDRV_DEVICE_TYPE_COMPRESS:
+ break;
+ default:
+ return -EINVAL;
+ }
+
for (minor = 0; minor < ARRAY_SIZE(snd_minors); ++minor) {
/* skip static minors still used for module auto loading */
if (SNDRV_MINOR_DEVICE(minor) == SNDRV_MINOR_CONTROL)
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ALSA: core: Validate device type for dynamic minors
2026-11-04 15:52 [PATCH] ALSA: core: Validate device type for dynamic minors Sreeraj S Kurup
@ 2026-11-05 7:49 ` Takashi Iwai
2026-11-05 14:13 ` Sreeraj S Kurup
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2026-11-05 7:49 UTC (permalink / raw)
To: Sreeraj S Kurup; +Cc: perex, tiwai, tiwai, linux-sound, linux-kernel
On Wed, 04 Nov 2026 16:52:05 +0100,
Sreeraj S Kurup wrote:
>
> Reject unsupported device types when allocating dynamic minors.
>
> This prevents invalid device types from being registered and
> avoids unnecessarily consuming available minor numbers.
>
> Return -EINVAL for unsupported device types.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
As it's no urgent fix, I applied to for-next branch now.
thanks,
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-05 14:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 15:52 [PATCH] ALSA: core: Validate device type for dynamic minors Sreeraj S Kurup
2026-11-05 7:49 ` Takashi Iwai
2026-11-05 14:13 ` Sreeraj S Kurup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®