Skip to contentSkip to conversation

ibmvnic: Free rwi on reset success

PATCH Applied Nick Child 2 participants 2 messages Oct 31, 2022 – Nov 3, 2022

Subsystems (4)
lore
Share & tools
lore

Nick Child

author reviewer
#0 lore raw

PATCH 1/1 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 4f408e1fa6e1 ("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 4f408e1fa6e1 ("ibmvnic: retry reset if there are no other resets")

---

Links to related discussions:
- Same patch sent to net-next:

    https://lore.kernel.org/netdev/[email protected]/
 - Updated ibmvnic maintainers:
    https://lore.kernel.org/netdev/[email protected]/
 drivers/net/ethernet/ibm/ibmvnic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +8 -8
index 65dbfbec487a..9282381a438f 100644
@@ -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))
Signature · 1 line
2.31.1
#1 lore raw
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 31 Oct 2022 10:06:42 -0500 you wrote:

Free the rwi structure in the event that the last rwi in the list processed successfully. The logic in commit 4f408e1fa6e1 ("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 4f408e1fa6e1 ("ibmvnic: retry reset if there are no other resets")

[...]

Here is the summary with links:
- [net] ibmvnic: Free rwi on reset success

    https://git.kernel.org/netdev/net/c/d6dd2fe71153

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html