cxgb4: fix memory leak during module unload
authorRaju Rangoju <rajur@chelsio.com>
Wed, 16 Sep 2020 16:20:39 +0000 (21:50 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Sep 2020 23:29:20 +0000 (16:29 -0700)
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: 28b3870578ef ("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>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c

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