Re:

Ian Abbott
2025-10-23T13:31:16Z

On 23/10/2025 14:06, Ian Abbott wrote:
> Comedi allows legacy devices to be configured manually (with sys admin
> privileges) with ioctl calls at run time by specifying parameters such
> as board name, base port number and IRQ level. If not done correctly
> for the actual hardware being configured, there could be problems caused
> by unexpected interrupts (not to mention problems due to reading or
> writing incorrect hardware registers!).
>
> These patches protect various functions in the core comedi module from
> these problems by adding checks that the structures that the function
> uses are in a valid state, and remain in a valid state until no longer
> required by the function.
>
> Some low-level Comedi drivers use these structures directly outside of
> the core commedi function calls, and may also need fixing. That has not
> been done yet in this patch series, but it provides a mechanism to do
> so.
>
> 1) comedi: Add reference counting for Comedi command handling
> 2) comedi: Use reference count for asynchronous command functions
>
> drivers/comedi/comedi_buf.c | 274 ++++++++++++++++++++++++++-------------
> drivers/comedi/comedi_fops.c | 134 ++++++++++++++-----
> drivers/comedi/comedi_internal.h | 12 ++
> drivers/comedi/drivers.c | 134 ++++++++++++++-----
> include/linux/comedi/comedidev.h | 7 +
> 5 files changed, 401 insertions(+), 160 deletions(-)
>
> The alignment of the diff output in the second patch turned out a bit
> wonky due to similar changes in different sections of the files. I can
> split the patch if deemed necessary.

Sorry, I forgot to fill in the subject line when composing the intro.
I'll resend it.

--
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-