[media] v4l2-dev: fix race condition
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 26 Nov 2010 09:54:53 +0000 (06:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 1 Dec 2010 22:10:20 +0000 (20:10 -0200)
commitca9afe6f87b569cdf8e797395381f18ae23a2905
tree9c5475baf2bb90f05fe25e8ca6fa8f53c2fc05dc
parent879aa24d6394aa04b690a600a41ff500441ad384
[media] v4l2-dev: fix race condition

The unregister function had a race condition with the v4l2_open
function. Ensure that both functions test and clear the REGISTER
flag from within a critical section.

Thanks to Laurent Pinchart for finding this race.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-dev.c