Skip to content

Commit

Permalink
ibmvnic: Free rwi on reset success
Browse files Browse the repository at this point in the history
Free the rwi structure in the event that the last rwi in the list
processed successfully. The logic in commit 4f408e1 ("ibmvnic:
retry reset if there are no other resets") introduces an issue that
results in a 32 byte memory leak whenever the last rwi in the list
gets processed.

Fixes: 4f408e1 ("ibmvnic: retry reset if there are no other resets")
Signed-off-by: Nick Child <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Nick Child authored and kuba-moo committed Nov 3, 2022
1 parent 40e4eb3 commit d6dd2fe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/net/ethernet/ibm/ibmvnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3007,19 +3007,19 @@ static void __ibmvnic_reset(struct work_struct *work)
rwi = get_next_rwi(adapter);

/*
* If there is another reset queued, free the previous rwi
* and process the new reset even if previous reset failed
* (the previous reset could have failed because of a fail
* over for instance, so process the fail over).
*
* If there are no resets queued and the previous reset failed,
* the adapter would be in an undefined state. So retry the
* previous reset as a hard reset.
*
* Else, free the previous rwi and, if there is another reset
* queued, process the new reset even if previous reset failed
* (the previous reset could have failed because of a fail
* over for instance, so process the fail over).
*/
if (rwi)
kfree(tmprwi);
else if (rc)
if (!rwi && rc)
rwi = tmprwi;
else
kfree(tmprwi);

if (rwi && (rwi->reset_reason == VNIC_RESET_FAILOVER ||
rwi->reset_reason == VNIC_RESET_MOBILITY || rc))
Expand Down

0 comments on commit d6dd2fe

Please sign in to comment.