Skip to contentSkip to conversation

igb: Fix potential memory leak in igb_add_ethtool_nfc_entry

PATCH In review Mateusz Palczewski 2 participants 2 messages Oct 4, 2023 – Oct 13, 2023

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

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

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:
Signature · 6 lines
2.31.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Wednesday, October 4, 2023 3:55 PM
To: [email protected]
Cc: Palczewski, Mateusz <[email protected]>; Drewek, Wojciech <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v1] igb: Fix potential memory leak in igb_add_ethtool_nfc_entry

Quoted 9 lines

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(-)

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan