cxgb4vf: fix memleak in mac_hlist initialization
authorArjun Vynipadath <arjun@chelsio.com>
Fri, 9 Nov 2018 09:22:01 +0000 (14:52 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:51:07 +0000 (08:51 +0100)
commitcdec9eec4e356fef3805c854ceb90e72887d63e1
tree0295a8521ea53ae5fffdc5456ed4b225becf2f6d
parent2c299a22f47c3891b3ab3e1266be50e89ac7150d
cxgb4vf: fix memleak in mac_hlist initialization

[ Upstream commit 24357e06ba511ad874d664d39475dbb01c1ca450 ]

mac_hlist was initialized during adapter_up, which will be called
every time a vf device is first brought up, or every time when device
is brought up again after bringing all devices down. This means our
state of previous list is lost, causing a memleak if entries are
present in the list. To fix that, move list init to the condition
that performs initial one time adapter setup.

Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c