diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-07-04 11:15:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:56:09 -0400 |
commit | cb74cf5349a6a9225bbab278a808d5a0739c3b2c (patch) | |
tree | f666bd328e9f8cdfd47ebb71e2427d7ecd3b8137 | |
parent | 7dfff95366f48bf66f77c17cdc9ebd8be696ac5d (diff) |
[media] V4L: sh_mobile_ceu_camera: fix Oops when USERPTR mapping fails
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-by: Bastian Hecht <hechtb@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | 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 f86550703f8e..e54089802b6b 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -422,8 +422,12 @@ static void sh_mobile_ceu_videobuf_release(struct vb2_buffer *vb) | |||
422 | pcdev->active = NULL; | 422 | pcdev->active = NULL; |
423 | } | 423 | } |
424 | 424 | ||
425 | /* Doesn't hurt also if the list is empty */ | 425 | /* |
426 | list_del_init(&buf->queue); | 426 | * Doesn't hurt also if the list is empty, but it hurts, if queuing the |
427 | * buffer failed, and .buf_init() hasn't been called | ||
428 | */ | ||
429 | if (buf->queue.next) | ||
430 | list_del_init(&buf->queue); | ||
427 | 431 | ||
428 | spin_unlock_irq(&pcdev->lock); | 432 | spin_unlock_irq(&pcdev->lock); |
429 | } | 433 | } |