mirror of
https://github.com/torvalds/linux.git
synced 2024-11-07 12:41:55 +00:00
[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>
This commit is contained in:
parent
7dfff95366
commit
cb74cf5349
@ -422,8 +422,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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user