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>
Sat, 21 Dec 2019 09:40:51 +0000 (10:40 +0100)
commit473d22b0741d6ad8680bcaefe563a20ab02ceee4
tree4a05fdada97ed0cc55308e24e030cf3f7d5d000f
parent8bddce881ac1ab6dd3da2e1504601eeb2e84b170
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