Commit a9a6e3d6 authored by Wenwen Wang's avatar Wenwen Wang Committed by Kleber Sacilotto de Souza

cx82310_eth: fix a memory leak bug

BugLink: https://bugs.launchpad.net/bugs/1845374

[ Upstream commit 1eca92ee ]

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: default avatarWenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 34088564
...@@ -175,7 +175,8 @@ static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -175,7 +175,8 @@ static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf)
} }
if (!timeout) { if (!timeout) {
dev_err(&udev->dev, "firmware not ready in time\n"); dev_err(&udev->dev, "firmware not ready in time\n");
return -ETIMEDOUT; ret = -ETIMEDOUT;
goto err;
} }
/* enable ethernet mode (?) */ /* enable ethernet mode (?) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment