Skip to content

locking fixes for cx88

Jonathan Nieder linux-media lkml 3 versions – In review

Get series with b4
b4 am 20110405032014.GA4498@elie

Versions newest first · linked by author and title

  1. v1 posting 2/27 patches 6 repliesIn review
  2. v2 Latest7 patches 2 repliesIn review
  3. v1 posting 1/23 patches 7 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7cx88: protect per-device driver list with device lockdrivers/media/video/cx88/cx88-blackbird.c drivers/media/video/cx88/cx88-dvb.c drivers/media/video/cx88/cx88-mpeg.c +1 more+20 -60 replies
2/7cx88: fix locking of sub-driver operationsdrivers/media/video/cx88/cx88-blackbird.c drivers/media/video/cx88/cx88-dvb.c drivers/media/video/cx88/cx88-mpeg.c +1 more+5 -90 replies
3/7cx88: hold device lock during sub-driver initializationdrivers/media/video/cx88/cx88-blackbird.c drivers/media/video/cx88/cx88-mpeg.c drivers/media/video/cx88/cx88.h+4 -100 replies
4/7cx88: use a mutex to protect cx8802_devlistdrivers/media/video/cx88/cx88-mpeg.c+17 -30 replies
5/7cx88: gracefully reject attempts to use unregistered cx88-blackbird driverdrivers/media/video/cx88/cx88-blackbird.c+14 -110 replies
6/7cx88: don't use atomic_t for core->mpeg_usersdrivers/media/video/cx88/cx88-blackbird.c drivers/media/video/cx88/cx88.h+7 -60 replies
7/7cx88: don't use atomic_t for core->usersdrivers/media/video/cx88/cx88-video.c drivers/media/video/cx88/cx88.h+4 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC/PATCH v2 0/7] locking fixes for cx88

Hi again,

Quoted 8 lines · Jonathan Nieder

Huber Andreas wrote[1]:

Quoted 1 line

Processes that try to open a cx88-blackbird driven MPEG device will hang up.

Here's a possible fix based on a patch by Ben Hutchings and corrections from Andi Huber. Warning: probably full of mistakes (my fault) since I'm not familiar with any of this stuff. Untested. Review and testing would be welcome.

A reroll. As before, the goals are: (1) eliminate deadlock, (2) eliminate races, (3) introduce some clarity. The same caveats as last time apply --- this is only compile-tested. Thanks again to Andi for testing the previous series and for other useful feedback.

Patch 1 is meant to protect dev->drvlist against data races. Since v1, I removed some clutter in the patch itself and clarified the change description to match.

Patch 2 addresses the original deadlock. The only changes are the description and declared authorship of the patch (at Ben's request).

Patch 3 is new. It fixes the reference count breakage Andi noticed (another race previously protected against by the BKL).

Patch 4 fixes a data race noticed by Ben (also from his patch). It's unchanged.

Patches 5, 6, and 7 are cleanups.

Bugs? Thoughts?
Jonathan Nieder (7):
[media] cx88: protect per-device driver list with device lock [media] cx88: fix locking of sub-driver operations [media] cx88: hold device lock during sub-driver initialization [media] cx88: use a mutex to protect cx8802_devlist [media] cx88: handle attempts to use unregistered cx88-blackbird
driver
[media] cx88: don't use atomic_t for core->mpeg_users [media] cx88: don't use atomic_t for core->users

 drivers/media/video/cx88/cx88-blackbird.c |   41 +++++++++++++++-------------
 drivers/media/video/cx88/cx88-dvb.c       |    2 +
 drivers/media/video/cx88/cx88-mpeg.c      |   40 ++++++++++++++++++----------
 drivers/media/video/cx88/cx88-video.c     |    5 ++-
 drivers/media/video/cx88/cx88.h           |   11 +++++--
 5 files changed, 61 insertions(+), 38 deletions(-)