Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdec9eec authored by Arjun Vynipadath's avatar Arjun Vynipadath Committed by Greg Kroah-Hartman
Browse files

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: default avatarArjun Vynipadath <arjun@chelsio.com>
Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 2c299a22
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -722,6 +722,10 @@ static int adapter_up(struct adapter *adapter)

		if (adapter->flags & USING_MSIX)
			name_msix_vecs(adapter);

		/* Initialize hash mac addr list*/
		INIT_LIST_HEAD(&adapter->mac_hlist);

		adapter->flags |= FULL_INIT_DONE;
	}

@@ -747,8 +751,6 @@ static int adapter_up(struct adapter *adapter)
	enable_rx(adapter);
	t4vf_sge_start(adapter);

	/* Initialize hash mac addr list*/
	INIT_LIST_HEAD(&adapter->mac_hlist);
	return 0;
}