]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ibmvnic: free reset-work-item when flushing
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Fri, 25 Feb 2022 06:23:51 +0000 (22:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Feb 2022 10:57:46 +0000 (10:57 +0000)
Fix a tiny memory leak when flushing the reset work queue.

Fixes: 2770a7984db5 ("ibmvnic: Introduce hard reset recovery")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index dee05a353dbd30cf85787fa572fa72e4d7d43d88..86d52217189255b69c695db40329959beeaf37fd 100644 (file)
@@ -2784,8 +2784,10 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
         * flush reset queue and process this reset
         */
        if (adapter->force_reset_recovery && !list_empty(&adapter->rwi_list)) {
-               list_for_each_safe(entry, tmp_entry, &adapter->rwi_list)
+               list_for_each_safe(entry, tmp_entry, &adapter->rwi_list) {
                        list_del(entry);
+                       kfree(list_entry(entry, struct ibmvnic_rwi, list));
+               }
        }
        rwi->reset_reason = reason;
        list_add_tail(&rwi->list, &adapter->rwi_list);