Re: [PATCH 0/5] media: uvcvideo: Fix race conditions

Guenter Roeck
2020-09-03T03:19:16Z

On Sun, Aug 30, 2020 at 05:10:10PM -0700, Guenter Roeck wrote:
> On Mon, Aug 31, 2020 at 12:36:21AM +0300, Laurent Pinchart wrote:
> > Hi Guenter,
> >
> [ ... ]
>
> > I'll try to prototype what I envision would be a good solution in the
> > V4L2 core. If stars align, I may even try to push it one level up, to
> > the chardev layer. Would you then be able to test it ?
> >
>
> Sure, I'll be happy to do that.
>
> I ordered a couple of non-UVC webcams (pwc and gspca) from eBay for
> comparison. Both of those use the v4l2 locking mechanism, so we should
> be able to see the difference.
>

Turns out gspca webcams (or at least the one I got - Logitech QuickCam for
Notebooks Deluxe) don't have a problem. As mentioned before, the gspca
driver uses the locking mechanism provided by the v4l2/vb2 code. Unlike
uvcvideo, its open function doesn't trigger sending send usb packets.
Its usb disconnect function acquires the lock, and the rest of the code
holds that lock where needed. I''ll keep trying, but so far I can't
get it to do anything wrong.

I am still waiting for the pwc webcam, but that also uses the v4l2/vb2
locking mechanism, and it seems unlikely that I'll get it to fail.
I'll try anyway.

Guenter