]> git.baikalelectronics.ru Git - kernel.git/commit
[media] v4l: vb2: Fix race condition in vb2_fop_poll
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sat, 1 Nov 2014 13:32:28 +0000 (10:32 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 4 Dec 2014 14:41:11 +0000 (12:41 -0200)
commit6a5b89ea89b98d3496ddcbb8795d0da7524525ef
tree9b8da082484a7f90c4da7bc7e425f254ceb92c0f
parent9c49209ba01d1d1dc4b6c18f9cfa8ee2c3f71838
[media] v4l: vb2: Fix race condition in vb2_fop_poll

The vb2_fop_poll() implementation tries to be clever on whether it needs
to lock the queue mutex by checking whether polling might start fileio.
The test requires reading the q->num_buffer field, which is racy if we
don't hold the queue mutex in the first place.

Remove the extra cleverness and just lock the mutex.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/videobuf2-core.c