summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-14 21:03:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-10 12:35:18 +0300
commit241a735f5f68c9d909d72ac062a18c64945e3f40 (patch)
tree4fbe0caa6ba22b4fda508e46fa93718ab2387d75
parente8f8411a8deffc743abc7a322b4289acb78ac13d (diff)
downloadlinux-241a735f5f68c9d909d72ac062a18c64945e3f40.tar.xz
cx82310_eth: fix a memory leak bug
[ Upstream commit 1eca92eef18719027d394bf1a2d276f43e7cf886 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/usb/cx82310_eth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c
index 5519248a791e..32b08b18e120 100644
--- a/drivers/net/usb/cx82310_eth.c
+++ b/drivers/net/usb/cx82310_eth.c
@@ -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 (?) */