All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [next PATCH S80-V3 01/11] i40e: use the safe hash table iterator when deleting mac filters
@ 2017-09-07 12:05 Alice Michael
  2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 02/11] i40evf: fix mac filter removal timing issue Alice Michael
                   ` (10 more replies)
  0 siblings, 11 replies; 26+ messages in thread
From: Alice Michael @ 2017-09-07 12:05 UTC (permalink / raw)
  To: intel-wired-lan

From: Lihong Yang <lihong.yang@intel.com>

This patch replaces hash_for_each function with hash_for_each_safe
when calling  __i40e_del_filter. The hash_for_each_safe function is
the right one to use when iterating over a hash table to safely remove
a hash entry. Otherwise, incorrect values may be read from freed memory.

Detected by CoverityScan, CID 1402048 Read from pointer after free

Signed-off-by: Lihong Yang <lihong.yang@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 8bedc74c..d8fbdda 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2880,6 +2880,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 	struct i40e_mac_filter *f;
 	struct i40e_vf *vf;
 	int ret = 0;
+	struct hlist_node *h;
 	int bkt;
 
 	/* validate the request */
@@ -2918,7 +2919,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 	/* Delete all the filters for this VSI - we're going to kill it
 	 * anyway.
 	 */
-	hash_for_each(vsi->mac_filter_hash, bkt, f, hlist)
+	hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
 		__i40e_del_filter(vsi, f);
 
 	spin_unlock_bh(&vsi->mac_filter_hash_lock);
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-10-05 23:25 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07 12:05 [Intel-wired-lan] [next PATCH S80-V3 01/11] i40e: use the safe hash table iterator when deleting mac filters Alice Michael
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 02/11] i40evf: fix mac filter removal timing issue Alice Michael
2017-09-12 20:23   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 03/11] i40e/i40evf: fix incorrect default ITR values on driver load Alice Michael
2017-09-12 20:30   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 04/11] i40e/i40evf: always set the CLEARPBA flag when re-enabling interrupts Alice Michael
2017-09-12 20:46   ` Bowers, AndrewX
2017-10-05 18:31     ` Duyck, Alexander H
2017-10-05 22:24       ` Keller, Jacob E
2017-10-05 23:01         ` Jesse Brandeburg
2017-10-05 23:25           ` Keller, Jacob E
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 05/11] i40e: reduce lrxqthresh from 2 to 1 Alice Michael
2017-09-12 21:33   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 06/11] i40e/i40evf: bump tail only in multiples of 8 Alice Michael
2017-09-12 21:40   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 07/11] i40e/i40evf: bundle more descriptors when allocating buffers Alice Michael
2017-09-12 21:41   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 08/11] i40e: allow XPS with QoS enabled Alice Michael
2017-09-12 21:47   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 09/11] i40e: add check for return from find_first_bit call Alice Michael
2017-09-12 21:48   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 10/11] i40e: Retry AQC GetPhyAbilities to overcome I2CRead hangs Alice Michael
2017-09-12 22:15   ` Bowers, AndrewX
2017-09-07 12:05 ` [Intel-wired-lan] [next PATCH S80-V3 11/11] i40e: use a local variable instead of calculating multiple times Alice Michael
2017-09-12 21:52   ` Bowers, AndrewX
2017-09-12 16:53 ` [Intel-wired-lan] [next PATCH S80-V3 01/11] i40e: use the safe hash table iterator when deleting mac filters Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.