]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: usb: pegasus: fix memory leak in update_eth_regs_async()
authorPetko Manolov <petkan@nucleusys.com>
Tue, 6 Jan 2026 08:48:21 +0000 (10:48 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Jan 2026 16:40:20 +0000 (08:40 -0800)
When asynchronously writing to the device registers and if usb_submit_urb()
fail, the code fail to release allocated to this point resources.

Fixes: 323b34963d11 ("drivers: net: usb: pegasus: fix control urb submission")
Signed-off-by: Petko Manolov <petkan@nucleusys.com>
Link: https://patch.msgid.link/20260106084821.3746677-1-petko.manolov@konsulko.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/usb/pegasus.c

index 81ca64debc5b9441a100846265d99550ed5b7307..c514483134f05f31a76b7b8d69db1f5256d34ace 100644 (file)
@@ -168,6 +168,8 @@ static int update_eth_regs_async(pegasus_t *pegasus)
                        netif_device_detach(pegasus->net);
                netif_err(pegasus, drv, pegasus->net,
                          "%s returned %d\n", __func__, ret);
+               usb_free_urb(async_urb);
+               kfree(req);
        }
        return ret;
 }