cxgb4: fix memory leak during module unload

[ Upstream commit f4a26a9b31 ]

Fix the memory leak in mps during module unload
path by freeing mps reference entries if the list
adpter->mps_ref is not already empty

Fixes: 28b3870578 ("cxgb4: Re-work the logic for mps refcounting")
Signed-off-by: Raju Rangoju <rajur@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Raju Rangoju 2020-09-16 21:50:39 +05:30 committed by Greg Kroah-Hartman
parent 6743a9b020
commit 2583159735

View File

@ -229,7 +229,7 @@ void cxgb4_free_mps_ref_entries(struct adapter *adap)
{ {
struct mps_entries_ref *mps_entry, *tmp; struct mps_entries_ref *mps_entry, *tmp;
if (!list_empty(&adap->mps_ref)) if (list_empty(&adap->mps_ref))
return; return;
spin_lock(&adap->mps_ref_lock); spin_lock(&adap->mps_ref_lock);