Commit d6dd2fe7 authored by Nick Child's avatar Nick Child Committed by Jakub Kicinski

ibmvnic: Free rwi on reset success

Free the rwi structure in the event that the last rwi in the list
processed successfully. The logic in commit 4f408e1f ("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: 4f408e1f ("ibmvnic: retry reset if there are no other resets")
Signed-off-by: default avatarNick Child <nnac123@linux.ibm.com>
Link: https://lore.kernel.org/r/20221031150642.13356-1-nnac123@linux.ibm.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 40e4eb32
...@@ -3007,19 +3007,19 @@ static void __ibmvnic_reset(struct work_struct *work) ...@@ -3007,19 +3007,19 @@ static void __ibmvnic_reset(struct work_struct *work)
rwi = get_next_rwi(adapter); 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, * If there are no resets queued and the previous reset failed,
* the adapter would be in an undefined state. So retry the * the adapter would be in an undefined state. So retry the
* previous reset as a hard reset. * 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) if (!rwi && rc)
kfree(tmprwi);
else if (rc)
rwi = tmprwi; rwi = tmprwi;
else
kfree(tmprwi);
if (rwi && (rwi->reset_reason == VNIC_RESET_FAILOVER || if (rwi && (rwi->reset_reason == VNIC_RESET_FAILOVER ||
rwi->reset_reason == VNIC_RESET_MOBILITY || rc)) rwi->reset_reason == VNIC_RESET_MOBILITY || rc))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment