From: Bastian Hecht <hechtb@googlemail.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH] V4L: sh_mobile_ceu_camera: fix Oops when USERPTR mapping fails
Date: Mon, 4 Jul 2011 17:29:54 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1107041728360.30004@bender> (raw)
In-Reply-To: <Pine.LNX.4.64.1107041713500.28687@axis700.grange>
On Mon, 4 Jul 2011, Guennadi Liakhovetski wrote:
> If vb2_dma_contig_get_userptr() fails on a videobuffer, driver's
> .buf_init() method will not be called and the list will not be
> initialised. Trying to remove an uninitialised element from a list leads
> to a NULL-dereference.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested on mackerel.
Tested-by: Bastian Hecht <hechtb@gmail.com>
Thanks,
Bastian
> ---
> drivers/media/video/sh_mobile_ceu_camera.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
> index 3ae5c9c..a851a3e 100644
> --- a/drivers/media/video/sh_mobile_ceu_camera.c
> +++ b/drivers/media/video/sh_mobile_ceu_camera.c
> @@ -421,8 +421,12 @@ static void sh_mobile_ceu_videobuf_release(struct vb2_buffer *vb)
> pcdev->active = NULL;
> }
>
> - /* Doesn't hurt also if the list is empty */
> - list_del_init(&buf->queue);
> + /*
> + * Doesn't hurt also if the list is empty, but it hurts, if queuing the
> + * buffer failed, and .buf_init() hasn't been called
> + */
> + if (buf->queue.next)
> + list_del_init(&buf->queue);
>
> spin_unlock_irq(&pcdev->lock);
> }
> --
> 1.7.2.5
>
prev parent reply other threads:[~2011-07-04 15:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-04 15:15 [PATCH] V4L: sh_mobile_ceu_camera: fix Oops when USERPTR mapping fails Guennadi Liakhovetski
2011-07-04 15:29 ` Bastian Hecht [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=alpine.DEB.2.02.1107041728360.30004@bender \
--to=hechtb@googlemail.com \
--cc=g.liakhovetski@gmx.de \
--cc=linux-media@vger.kernel.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