gpib: lpvo_usb: fix memory leak on disconnect
Subsystems (2)
PATCH 1/1 gpib: lpvo_usb: fix memory leak on disconnect
The driver iterates over the registered USB interfaces during GPIB attach and takes a reference to their USB devices until a match is found. These references are never released which leads to a memory leak when devices are disconnected.
Fix the leak by dropping the unnecessary references.
Fixes fce79512a96a ("staging: gpib: Add LPVO DIY USB GPIB driver")
Cc [email protected] # 6.13
Cc Dave Penkler <[email protected]>
Signed-off-by Johan Hovold <[email protected]>
--- drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +2 -2
@@ -402,7 +402,7 @@ static int usb_gpib_attach(struct gpib_board *board, const struct gpib_board_confor (j =0 ; j <MAX_DEV ; j++) {if ((assigned_usb_minors &1 << j) ==0 )continue ; - udev =usb_get_dev (interface_to_usbdev (lpvo_usb_interfaces[j])); + udev =interface_to_usbdev (lpvo_usb_interfaces[j]); device_path =kobject_get_path (&udev->dev.kobj,GFP_KERNEL ); match =gpib_match_device_path (&lpvo_usb_interfaces[j]->dev, config->device_path);
@@ -417,7 +417,7 @@ static int usb_gpib_attach(struct gpib_board *board, const struct gpib_board_confor (j =0 ; j <MAX_DEV ; j++) {if ((assigned_usb_minors &1 << j) ==0 )continue ; - udev =usb_get_dev (interface_to_usbdev (lpvo_usb_interfaces[j])); + udev =interface_to_usbdev (lpvo_usb_interfaces[j]);DIA_LOG (1 ,"dev. %d: bus %d -> %d dev: %d -> %d\n" , j, udev->bus->busnum, config->pci_bus, udev->devnum, config->pci_slot); if (config->pci_bus == udev->bus->busnum &&
Signature · 1 line
2.52.0
Quoted 5 lines · Johan Hovold
The driver iterates over the registered USB interfaces during GPIB attach and takes a reference to their USB devices until a match is found. These references are never released which leads to a memory leak when devices are disconnected.
Quoted 7 lines
Fix the leak by dropping the unnecessary references.
Fixes fce79512a96a ("staging: gpib: Add LPVO DIY USB GPIB driver")Cc [email protected] # 6.13Cc Dave Penkler <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Can this one be picked up for 7.1?
Johan