]> err.no Git - linux-2.6/commitdiff
[ALSA] sound: fix PCM substream list
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 23 Nov 2006 11:03:24 +0000 (12:03 +0100)
committerJaroslav Kysela <perex@server.perex.cz>
Wed, 20 Dec 2006 07:56:00 +0000 (08:56 +0100)
If snd_pcm_new_stream() fails to initalize a substream (if
snd_pcm_substream_proc_init() returns error), snd_pcm_new_stream()
immediately return without unlinking that kfree()d substram.
It causes oops when snd_pcm_free() iterates the list of substream to
free them by invalid reference.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/core/pcm.c

index 5ac6e19ccb4128814c2356f634c43a46a67b0ccf..8e018988551610574daece3988e78d53d1ca9c5d 100644 (file)
@@ -640,6 +640,10 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
                err = snd_pcm_substream_proc_init(substream);
                if (err < 0) {
                        snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
+                       if (prev == NULL)
+                               pstr->substream = NULL;
+                       else
+                               prev->next = NULL;
                        kfree(substream);
                        return err;
                }