From: Takashi Iwai <tiwai@suse.de>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, Jaroslav Kysela <perex@suse.cz>
Subject: Re: [PATCH] sound: initialize rawmidi substream list
Date: Thu, 23 Nov 2006 12:06:26 +0100 [thread overview]
Message-ID: <s5hac2ih171.wl%tiwai@suse.de> (raw)
In-Reply-To: <20061122185045.GE2985@APFDCB5C>
At Thu, 23 Nov 2006 03:50:45 +0900,
Akinobu Mita wrote:
>
> 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.
>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Jaroslav Kysela <perex@suse.cz>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Thanks, merged to ALSA tree.
Takashi
>
> sound/core/rawmidi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: work-fault-inject/sound/core/rawmidi.c
> ===================================================================
> --- work-fault-inject.orig/sound/core/rawmidi.c
> +++ work-fault-inject/sound/core/rawmidi.c
> @@ -1379,7 +1379,6 @@ static int snd_rawmidi_alloc_substreams(
> 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) {
> @@ -1434,6 +1433,9 @@ int snd_rawmidi_new(struct snd_card *car
> 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,
>
prev parent reply other threads:[~2006-11-23 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 18:50 Akinobu Mita
2006-11-23 11:06 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hac2ih171.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=akinobu.mita@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®