Skip to content

Commit 5cefb52

Browse files
jhovoldgregkh
authored andcommitted
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: fce7951 ("staging: gpib: Add LPVO DIY USB GPIB driver") Cc: stable <stable@kernel.org> # 6.13 Cc: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260310105127.17538-1-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 579af72 commit 5cefb52

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ static int usb_gpib_attach(struct gpib_board *board, const struct gpib_board_con
406406
for (j = 0 ; j < MAX_DEV ; j++) {
407407
if ((assigned_usb_minors & 1 << j) == 0)
408408
continue;
409-
udev = usb_get_dev(interface_to_usbdev(lpvo_usb_interfaces[j]));
409+
udev = interface_to_usbdev(lpvo_usb_interfaces[j]);
410410
device_path = kobject_get_path(&udev->dev.kobj, GFP_KERNEL);
411411
match = gpib_match_device_path(&lpvo_usb_interfaces[j]->dev,
412412
config->device_path);
@@ -421,7 +421,7 @@ static int usb_gpib_attach(struct gpib_board *board, const struct gpib_board_con
421421
for (j = 0 ; j < MAX_DEV ; j++) {
422422
if ((assigned_usb_minors & 1 << j) == 0)
423423
continue;
424-
udev = usb_get_dev(interface_to_usbdev(lpvo_usb_interfaces[j]));
424+
udev = interface_to_usbdev(lpvo_usb_interfaces[j]);
425425
DIA_LOG(1, "dev. %d: bus %d -> %d dev: %d -> %d\n", j,
426426
udev->bus->busnum, config->pci_bus, udev->devnum, config->pci_slot);
427427
if (config->pci_bus == udev->bus->busnum &&

0 commit comments

Comments
 (0)