Re: [PATCH] video4linux: Push down the BKL

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mauro Carvalho Chehab
Date: Tuesday, May 27, 2008 - 9:31 am

On Tue, 27 May 2008 09:41:44 -0600
Jonathan Corbet <corbet@lwn.net> wrote:



True, but on a quick analysis, I suspect that this is already somewhat broken
on some drivers.

Since the other methods don't explicitly call BKL (and, AFAIK, kernel open
handler don't call it neither), if a program 1 is opening a device and
initializing some data, and a program 2 starts doing ioctl, interrupting
program 1 execution in the middle of a data initialization procedure, you may
have a race condition, since some devices initialize some device global data
during open [1].

[1] For example: cx88 and saa7134 will change some data structures if you open
a device via /dev/radio or via /dev/video. So, if program 1 opens as radio and
program 2 opens as video, you may have a race condition. A way to fix this is to
initialize such structs only by the first program that is opening the device,
and serialize a concurrent open.


True. Yet, just looking at the code may not be enough, since people make
mistakes. The recent changes at videobuf lock showed this. The lock fix
patches caused several new locking issues.

It is safer to have a tool to test and stress the driver before going to
production.

Cheers,
Mauro
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] video4linux: Push down the BKL, Alan Cox, (Thu May 22, 2:37 pm)
Re: [PATCH] video4linux: Push down the BKL, Andy Walls, (Thu May 22, 7:08 pm)
Re: [PATCH] video4linux: Push down the BKL, Hans Verkuil, (Thu May 22, 11:16 pm)
Re: [PATCH] video4linux: Push down the BKL, Hans Verkuil, (Thu May 22, 11:28 pm)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Fri May 23, 2:09 am)
Re: [PATCH] video4linux: Push down the BKL , Jonathan Corbet, (Fri May 23, 6:56 am)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Fri May 23, 8:39 am)
Re: [PATCH] video4linux: Push down the BKL , Jonathan Corbet, (Fri May 23, 9:09 am)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Fri May 23, 11:58 am)
Re: [PATCH] video4linux: Push down the BKL, Hans Verkuil, (Fri May 23, 12:05 pm)
Re: [PATCH] video4linux: Push down the BKL, Mike Isely, (Sun May 25, 4:46 pm)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Mon May 26, 9:34 am)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Mon May 26, 9:39 am)
Re: [PATCH] video4linux: Push down the BKL, Hans Verkuil, (Mon May 26, 9:46 am)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Mon May 26, 9:59 am)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Mon May 26, 1:23 pm)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Mon May 26, 2:10 pm)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Mon May 26, 2:14 pm)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Mon May 26, 3:01 pm)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Tue May 27, 6:10 am)
Re: [PATCH] video4linux: Push down the BKL, Jonathan Corbet, (Tue May 27, 8:41 am)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Tue May 27, 9:31 am)
Re: [PATCH] video4linux: Push down the BKL, Jonathan Corbet, (Tue May 27, 9:37 am)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Tue May 27, 11:14 am)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Tue May 27, 11:59 am)
Re: [PATCH] video4linux: Push down the BKL, Devin Heitmueller, (Tue May 27, 12:26 pm)
Re: [PATCH] video4linux: Push down the BKL, Arjan van de Ven, (Tue May 27, 12:50 pm)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Tue May 27, 1:24 pm)
Re: [PATCH] video4linux: Push down the BKL, Mauro Carvalho Chehab, (Tue May 27, 2:00 pm)
Re: [PATCH] video4linux: Push down the BKL, Devin Heitmueller, (Tue May 27, 2:22 pm)
Re: [PATCH] video4linux: Push down the BKL, Andy Walls, (Tue May 27, 4:48 pm)
Re: [PATCH] video4linux: Push down the BKL, Devin Heitmueller, (Tue May 27, 5:46 pm)
Re: [PATCH] video4linux: Push down the BKL, Andy Walls, (Tue May 27, 7:37 pm)
Re: [PATCH] video4linux: Push down the BKL, Devin Heitmueller, (Tue May 27, 7:47 pm)
Re: [PATCH] video4linux: Push down the BKL, Hans Verkuil, (Tue May 27, 11:13 pm)
Re: [PATCH] video4linux: Push down the BKL, Alan Cox, (Wed May 28, 1:34 am)