Re: [PATCH] comedi: comedi_bond: Fix leak of opened device references
From: Ian Abbott
Date: Wed Nov 04 2026 - 09:05:33 EST
On 04/11/2026 12:59, Greg Kroah-Hartman wrote:
On Tue, Nov 03, 2026 at 05:36:10PM +0000, Ian Abbott wrote:
bonding_attach() calls do_dev_config() to open other comedi devices
specified by the user and tries to make use of them as part of the
'bonding' device. If it successfully opens the other device but cannot
use it (either because it does not any subdevices of a type the
'bonding' device can use, or because of some error that occurs while
dealing with its subdevices) then it is left in the open state and the
fact that it is open does not get recorded by the 'bonding' device, so
the reference to the opened device gets lost. Fix it by closing the
opened device if it could not be bound to the 'bonding' device.
To match previous behavior, if the opened device is unsuitable then
ignore it (after closing it). The opened devices recorded by the
'bonding' device will eventually get closed by bonding_detach() even if
bonding_attach() returns an error.
Fixes: 3cf840f65ad5 ("Staging: comedi: add comedi_bond driver")
Reported-by: Wentao Liang <vulab@xxxxxxxxxxx>
This is a known bot. I'll be glad to take this patch if you redo it
from you and that you take the authorship. As-is, I can't take it from
this fake "author", sorry.
greg k-h
Actually, I did redo it in a completely different way to the original patch. I just used the original patch as a bug report. Should I remove just the "Reported-by:" line, or should I also remove the "Link:" to the original patch from the bot?
Cheers,
Ian
--
-=( Ian Abbott <abbotti@xxxxxxxxx> || 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 )=-