]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cx82310_eth: fix a memory leak bug
authorWenwen Wang <wenwen@cs.uga.edu>
Wed, 14 Aug 2019 18:03:38 +0000 (13:03 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Aug 2019 20:01:54 +0000 (13:01 -0700)
In cx82310_bind(), 'dev->partial_data' is allocated through kmalloc().
Then, the execution waits for the firmware to become ready. If the firmware
is not ready in time, the execution is terminated. However, the allocated
'dev->partial_data' is not deallocated on this path, leading to a memory
leak bug. To fix this issue, free 'dev->partial_data' before returning the
error.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cx82310_eth.c

index 5519248a791ebefd9003ae6892894f2d95b96a03..32b08b18e12086f9634284b54a2f336994986092 100644 (file)
@@ -163,7 +163,8 @@ static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf)
        }
        if (!timeout) {
                dev_err(&udev->dev, "firmware not ready in time\n");
-               return -ETIMEDOUT;
+               ret = -ETIMEDOUT;
+               goto err;
        }
 
        /* enable ethernet mode (?) */