* [PATCH] sound: fix PCM substream list
@ 2006-11-22 18:51 Akinobu Mita
2006-11-23 11:06 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2006-11-22 18:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Takashi Iwai, Jaroslav Kysela
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.
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@suse.cz>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
sound/core/pcm.c | 4 ++++
1 file changed, 4 insertions(+)
Index: work-fault-inject/sound/core/pcm.c
===================================================================
--- work-fault-inject.orig/sound/core/pcm.c
+++ work-fault-inject/sound/core/pcm.c
@@ -638,6 +638,10 @@ int snd_pcm_new_stream(struct snd_pcm *p
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sound: fix PCM substream list
2006-11-22 18:51 [PATCH] sound: fix PCM substream list Akinobu Mita
@ 2006-11-23 11:06 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2006-11-23 11:06 UTC (permalink / raw)
To: Akinobu Mita; +Cc: linux-kernel, Jaroslav Kysela
At Thu, 23 Nov 2006 03:51:45 +0900,
Akinobu Mita wrote:
>
> 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.
>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Jaroslav Kysela <perex@suse.cz>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Merged this one to ALSA tree, too.
Thanks.
Takashi
>
> ---
> sound/core/pcm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> Index: work-fault-inject/sound/core/pcm.c
> ===================================================================
> --- work-fault-inject.orig/sound/core/pcm.c
> +++ work-fault-inject/sound/core/pcm.c
> @@ -638,6 +638,10 @@ int snd_pcm_new_stream(struct snd_pcm *p
> 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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-23 11:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-22 18:51 [PATCH] sound: fix PCM substream list Akinobu Mita
2006-11-23 11:06 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox