cx82310_eth: fix a memory leak bug
authorWenwen Wang <wenwen@cs.uga.edu>
Wed, 14 Aug 2019 18:03:38 +0000 (13:03 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Sep 2019 09:31:01 +0000 (10:31 +0100)
commit08f7aa4e3082648e59c56c1b1ae52fd883511c33
tree826c37025a59cd4285d2eba833d201fe932480b5
parentb57c8626385d319d4ce8d47feeba7d28fb3e5f02
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>
drivers/net/usb/cx82310_eth.c