[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231019204035.3665021-1-jacob.e.keller@intel.com>
Date: Thu, 19 Oct 2023 13:40:35 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: netdev@...r.kernel.org,
David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Mateusz Palczewski <mateusz.palczewski@...el.com>,
Wojciech Drewek <wojciech.drewek@...el.com>,
Arpana Arland <arpanax.arland@...el.com>,
Jacob Keller <jacob.e.keller@...el.com>
Subject: [PATCH net] igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
From: Mateusz Palczewski <mateusz.palczewski@...el.com>
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")
Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@...el.com>
Tested-by: Arpana Arland <arpanax.arland@...el.com> (A Contingent worker at Intel)
Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 319ed601eaa1..4ee849985e2b 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -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
--
2.41.0
Powered by blists - more mailing lists