Skip to contentSkip to conversation

igb: Fix potential memory leak in igb_add_ethtool_nfc_entry

PATCH Applied Jacob Keller 2 participants 2 messages Oct 19, 2023 – Oct 20, 2023

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

PATCH 1/1 igb: Fix potential memory leak in igb_add_ethtool_nfc_entry

From: Mateusz Palczewski <[email protected]>

Add check for return of igb_update_ethtool_nfc_entry so that in case of any potential errors the memory alocated for input will be freed.

Fixes 0e71def25281 ("igb: add support of RX network flow classification")
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +5 -1
index 319ed601eaa1..4ee849985e2b 100644
@@ -2978,11 +2978,15 @@ static int igb_add_ethtool_nfc_entry(struct igb_adapter *adapter,
 	if (err)
 		goto err_out_w_lock;
 
-	igb_update_ethtool_nfc_entry(adapter, input, input->sw_idx);
+	err = igb_update_ethtool_nfc_entry(adapter, input, input->sw_idx);
+	if (err)
+		goto err_out_input_filter;
 
 	spin_unlock(&adapter->nfc_lock);
 	return 0;
 
+err_out_input_filter:
+	igb_erase_filter(adapter, input);
 err_out_w_lock:
 	spin_unlock(&adapter->nfc_lock);
 err_out:

base-commit: ce55c22ec8b223a90ff3e084d842f73cfba35588

Signature · 1 line
2.41.0
#1 lore raw
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

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

Quoted 5 lines · On Thu, 19 Oct 2023 13:40:35 -0700 you wrote:

From: Mateusz Palczewski <[email protected]>

Add check for return of igb_update_ethtool_nfc_entry so that in case of any potential errors the memory alocated for input will be freed.

Quoted 7 lines
Fixes 0e71def25281 ("igb: add support of RX network flow classification")

[...]

Here is the summary with links:
- [net] igb: Fix potential memory leak in igb_add_ethtool_nfc_entry

    https://git.kernel.org/netdev/net/c/8c0b48e01dab

You are awesome, thank you!

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