igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
[ Upstream commit 8c0b48e01daba5ca58f939a8425855d3f4f2ed14 ]
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: 0e71def252
("igb: add support of RX network flow classification")
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
1ac4f8e555
commit
77c4f14f95
@@ -2987,11 +2987,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:
|
||||
|
Reference in New Issue
Block a user