Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c13893d7be4f159b359a1b7ee46b3646ecb2fe20 Commit: c13893d7be4f159b359a1b7ee46b3646ecb2fe20 Parent: a48bb28c167b5cad1bd4978dbb83c89252caab78 Author: Akinobu Mita <[EMAIL PROTECTED]> AuthorDate: Thu Nov 23 12:02:33 2006 +0100 Committer: Jaroslav Kysela <[EMAIL PROTECTED]> CommitDate: Wed Dec 20 08:55:59 2006 +0100
[ALSA] sound: initialize rawmidi substream list If snd_rawmidi_new() failed to allocate substreams for input (snd_rawmidi_alloc_substreams() failed to populate a &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]), it will try to free rawmidi instance by snd_rawmidi_free(). But it will cause oops because snd_rawmidi_free() tries to free both of substreams list but list for output (&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]) is not initialized yet. Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]> Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]> Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]> --- sound/core/rawmidi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 269c467..0f055bf 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1385,7 +1385,6 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi, struct snd_rawmidi_substream *substream; int idx; - INIT_LIST_HEAD(&stream->substreams); for (idx = 0; idx < count; idx++) { substream = kzalloc(sizeof(*substream), GFP_KERNEL); if (substream == NULL) { @@ -1440,6 +1439,9 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, rmidi->device = device; mutex_init(&rmidi->open_mutex); init_waitqueue_head(&rmidi->open_wait); + INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams); + INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams); + if (id != NULL) strlcpy(rmidi->id, id, sizeof(rmidi->id)); if ((err = snd_rawmidi_alloc_substreams(rmidi, - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html