Skip to content

Commit 1eca92e

Browse files
wenwenwang1davem330
authored andcommitted
cx82310_eth: fix a memory leak bug
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a4d2d3 commit 1eca92e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/cx82310_eth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf)
163163
}
164164
if (!timeout) {
165165
dev_err(&udev->dev, "firmware not ready in time\n");
166-
return -ETIMEDOUT;
166+
ret = -ETIMEDOUT;
167+
goto err;
167168
}
168169

169170
/* enable ethernet mode (?) */

0 commit comments

Comments
 (0)