Skip to content

Commit

Permalink
cxgb4vf: fix memleak in mac_hlist initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
arjunvynipadath authored and davem330 committed Nov 9, 2018
1 parent 2a8d84b commit 24357e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit 24357e0

Please sign in to comment.