[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251027153748.4569-1-abbotti@mev.co.uk>
Date: Mon, 27 Oct 2025 15:25:01 +0000
From: Ian Abbott <abbotti@....co.uk>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ian Abbott <abbotti@....co.uk>,
H Hartley Sweeten <hsweeten@...ionengravers.com>
Subject: [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(-)
Powered by blists - more mailing lists