From: Takashi Iwai <tiwai@suse.de>
To: Oleksandr Andrushchenko <andr2000@gmail.com>
Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, alsa-devel@alsa-project.org,
jgross@suse.com, boris.ostrovsky@oracle.com,
Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: Re: [alsa-devel] [Xen-devel][PATCH 3/3] ALSA: xen-front: Use Xen common shared buffer implementation
Date: Thu, 22 Nov 2018 16:47:14 +0100 [thread overview]
Message-ID: <s5hzhu13yil.wl-tiwai@suse.de> (raw)
In-Reply-To: <20181122100230.14976-3-andr2000@gmail.com>
On Thu, 22 Nov 2018 11:02:30 +0100,
Oleksandr Andrushchenko wrote:
>
> @@ -214,12 +221,19 @@ static void stream_clear(struct xen_snd_front_pcm_stream_info *stream)
> stream->out_frames = 0;
> atomic_set(&stream->hw_ptr, 0);
> xen_snd_front_evtchnl_pair_clear(stream->evt_pair);
> - xen_snd_front_shbuf_clear(&stream->sh_buf);
> + memset(&stream->shbuf, 0, sizeof(stream->shbuf));
> + stream->buffer = NULL;
> + stream->buffer_sz = 0;
> + stream->pages = NULL;
> + stream->num_pages = 0;
> }
>
> static void stream_free(struct xen_snd_front_pcm_stream_info *stream)
> {
> - xen_snd_front_shbuf_free(&stream->sh_buf);
> + xen_front_pgdir_shbuf_unmap(&stream->shbuf);
> + xen_front_pgdir_shbuf_free(&stream->shbuf);
> + free_pages_exact(stream->buffer, stream->buffer_sz);
> + kfree(stream->pages);
> stream_clear(stream);
> }
>
> @@ -421,10 +435,34 @@ static int alsa_close(struct snd_pcm_substream *substream)
> return 0;
> }
>
> +static int shbuf_setup_backstore(struct xen_snd_front_pcm_stream_info *stream,
> + size_t buffer_sz)
> +{
> + int i;
> +
> + stream->buffer_sz = buffer_sz;
> + stream->buffer = alloc_pages_exact(stream->buffer_sz, GFP_KERNEL);
> + if (!stream->buffer)
> + return -ENOMEM;
This keeps the NULL stream->buffer, and then the caller goes to the
error path via stream_free() which will lead to an Oops due to the
unconditional call of free_pages_exact().
thanks,
Takashi
next prev parent reply other threads:[~2018-11-22 15:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 10:02 [Xen-devel][PATCH 1/3] xen: Introduce shared buffer helpers for page directory Oleksandr Andrushchenko
2018-11-22 10:02 ` [Xen-devel][PATCH 2/3] drm/xen-front: Use Xen common shared buffer implementation Oleksandr Andrushchenko
2018-11-22 14:33 ` Daniel Vetter
2018-11-23 8:24 ` Juergen Gross
2018-11-26 6:45 ` Oleksandr Andrushchenko
2018-11-22 10:02 ` [Xen-devel][PATCH 3/3] ALSA: xen-front: " Oleksandr Andrushchenko
2018-11-22 15:47 ` Takashi Iwai [this message]
2018-11-23 8:19 ` [alsa-devel] " Oleksandr Andrushchenko
2018-11-29 11:22 ` [Xen-devel][PATCH 1/3] xen: Introduce shared buffer helpers for page directory Oleksandr Andrushchenko
2018-11-30 6:50 ` Juergen Gross
2018-11-30 7:07 ` Oleksandr Andrushchenko
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=s5hzhu13yil.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=andr2000@gmail.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleksandr_andrushchenko@epam.com \
--cc=xen-devel@lists.xenproject.org \
/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;
as well as URLs for NNTP newsgroup(s).