Skip to content

comedi: comedi_bond: Prevent loops of bonded devices

Ian Abbott lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2comedi: kcomedilib: Add loop checking variants of open and closedrivers/comedi/kcomedilib/kcomedilib_main.c include/linux/comedi/comedilib.h+147 -70 replies
2/2comedi: comedi_bond: Check for loops when bonding devicesdrivers/comedi/drivers/comedi_bond.c+2 -20 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/2] comedi: comedi_bond: Prevent loops of bonded devices

The "comedi_bond" driver allows a COMEDI device to be set up that uses (or "bonds") the subdevices of another COMEDI device. But by reconfiguring that other COMEDI device to bond to the subdevices of the first COMEDI device, it is possible to form a loop of bonded devices. We want to avoid that because it is is both silly, and will result in mutex deadlocks when accessing the channels of the bonded devices.

This series of patches introduces variants of the comedi_open() and comedi_close() functions in the "kcomedilib" module that indicate which COMEDI device is attempting to open the other COMEDI device, so that this information can be saved by the "kcomedilib" and used to check for and prevent cycles of devices opening each other. The "comedi_bond" driver module is changed to use these variant functions (called comedi_open_from() and comedi_close_from()).

1) comedi: kcomedilib: Add loop checking variants of open and close
2) comedi: comedi_bond: Check for loops when bonding devices

 drivers/comedi/drivers/comedi_bond.c        |   4 +-
 drivers/comedi/kcomedilib/kcomedilib_main.c | 120 ++++++++++++++++++++++++++--
 include/linux/comedi/comedilib.h            |  34 +++++++-
 3 files changed, 149 insertions(+), 9 deletions(-)