All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ibmvnic: Free rwi on reset success
@ 2022-10-31 15:06 Nick Child
  2022-11-03  3:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Child @ 2022-10-31 15:06 UTC (permalink / raw)
  To: netdev; +Cc: haren, ricklind, danymadden, tlfalcon, Nick Child

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")
Signed-off-by: Nick Child <nnac123@linux.ibm.com>
---

Links to related discussions:
 - Same patch sent to net-next:
    https://lore.kernel.org/netdev/20221018130606.46c4ed3d@kernel.org/
 - Updated ibmvnic maintainers:
    https://lore.kernel.org/netdev/20221028203509.4070154-1-ricklind@us.ibm.com/

 drivers/net/ethernet/ibm/ibmvnic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 65dbfbec487a..9282381a438f 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -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))
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ibmvnic: Free rwi on reset success
  2022-10-31 15:06 [PATCH net] ibmvnic: Free rwi on reset success Nick Child
@ 2022-11-03  3:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-03  3:40 UTC (permalink / raw)
  To: Nick Child; +Cc: netdev, haren, ricklind, danymadden, tlfalcon

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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")
> Signed-off-by: Nick Child <nnac123@linux.ibm.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-03  3:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 15:06 [PATCH net] ibmvnic: Free rwi on reset success Nick Child
2022-11-03  3:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.