Skip to contentSkip to conversation

ethernet: marvell: octeontx2 Fix resource not freed after malloc

PATCH Superseded Manank Patel 3 participants 4 messages Oct 17, 2022 – Oct 19, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethernet: marvell: octeontx2 Fix resource not freed after malloc

fix rxsc not getting freed before going out of scope

Fixes c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
---
 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +1 -0
index 9809f551fc2e..c7b2ebb2c75b 100644
@@ -870,6 +870,7 @@ static struct cn10k_mcs_rxsc *cn10k_mcs_create_rxsc(struct otx2_nic *pfvf)
 	cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_FLOWID,
 			    rxsc->hw_flow_id, false);
 fail:
+	kfree(rxsc);
 	return ERR_PTR(ret);
 }
 
Signature · 1 line
2.38.0
#1 lore raw

Hi,

Quoted 15 lines · Manank Patel

fix rxsc not getting freed before going out of scope

Fixes c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
---
 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +0 -0
index 9809f551fc2e..c7b2ebb2c75b 100644

drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c static struct cn10k_mcs_rxsc *cn10k_mcs_create_rxsc(struct otx2_nic *pfvf) · line 873

Quoted 4 lines
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +1 -0
@@ -870,6 +870,7 @@ static struct cn10k_mcs_rxsc *cn10k_mcs_create_rxsc(struct otx2_nic *pfvf)
        cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_FLOWID,
                            rxsc->hw_flow_id, false);
 fail:
+       kfree(rxsc);

Thanks for the fix. Can you do the same in cn10k_mcs_create_txsc as well.

Sundeep

Quoted 6 lines
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +0 -1
        return ERR_PTR(ret);
 }
 
--

2.38.0

#2 lore raw

PATCH v2 1/1 ethernet: marvell: octeontx2 Fix resource not freed after malloc

fix rxsc and txsc not getting freed before going out of scope

Fixes c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")

---

Changelog
v1->v2:
add the same fix in cn10k_mcs_create_txsc

 drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +2 -0
index 9809f551fc2e..9ec5f38d38a8 100644
@@ -815,6 +815,7 @@ static struct cn10k_mcs_txsc *cn10k_mcs_create_txsc(struct otx2_nic *pfvf)
 	cn10k_mcs_free_rsrc(pfvf, MCS_TX, MCS_RSRC_TYPE_FLOWID,
 			    txsc->hw_flow_id, false);
 fail:
+	kfree(txsc);
 	return ERR_PTR(ret);
 }
 
@@ -870,6 +871,7 @@ static struct cn10k_mcs_rxsc *cn10k_mcs_create_rxsc(struct otx2_nic *pfvf)
 	cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_FLOWID,
 			    rxsc->hw_flow_id, false);
 fail:
+	kfree(rxsc);
 	return ERR_PTR(ret);
 }
 
Signature · 1 line
2.38.0
#3 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

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

Quoted 8 lines · On Tue, 18 Oct 2022 11:03:18 +0530 you wrote:

fix rxsc and txsc not getting freed before going out of scope

Fixes c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")

---

[...]

Here is the summary with links:
- [v2] ethernet: marvell: octeontx2 Fix resource not freed after malloc

    https://git.kernel.org/netdev/net/c/7b55c2ed2ba0

You are awesome, thank you!

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