aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-11-20 07:59:56 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:29:12 -0500
commita106cd3d9e88c8761bd0eac2ce402cc82bd11fea (patch)
tree1dd614d50a0bd30af45fd63372f02da5a5fe86e6 /sound/core
parentac09a9251d3b7678150ee512de8de1bd98628d11 (diff)
[ALSA] rawmidi: protect against invalid device number in snd_rawmidi_info_select()
Modules: RawMidi Midlevel In snd_rawmidi_info_select(), check that the device identified by the passed device number actually exists. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/rawmidi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 7a86a9a08a15..d703545cae8a 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -573,6 +573,8 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info
573 if (info->device >= SNDRV_RAWMIDI_DEVICES) 573 if (info->device >= SNDRV_RAWMIDI_DEVICES)
574 return -ENXIO; 574 return -ENXIO;
575 rmidi = snd_rawmidi_devices[card->number * SNDRV_RAWMIDI_DEVICES + info->device]; 575 rmidi = snd_rawmidi_devices[card->number * SNDRV_RAWMIDI_DEVICES + info->device];
576 if (!rmidi)
577 return -ENXIO;
576 if (info->stream < 0 || info->stream > 1) 578 if (info->stream < 0 || info->stream > 1)
577 return -EINVAL; 579 return -EINVAL;
578 pstr = &rmidi->streams[info->stream]; 580 pstr = &rmidi->streams[info->stream];