Skip to contentSkip to conversation

Patch "i40e: use the safe hash table iterator when deleting mac filters" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 20, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

i40e: use the safe hash table iterator when deleting mac filters

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
i40e-use-the-safe-hash-table-iterator-when-deleting-mac-filters.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Dec 20 18:17:52 CET 2017

From: Lihong Yang <[email protected]>
Date: Thu, 7 Sep 2017 08:05:46 -0400
Subject: i40e: use the safe hash table iterator when deleting mac filters

From: Lihong Yang <[email protected]>

[ Upstream commit 784548c40d6f43eff2297220ad7800dc04be03c6 ]

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

---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -1
@@ -2779,6 +2779,7 @@ int i40e_ndo_set_vf_mac(struct net_devic
 	struct i40e_mac_filter *f;
 	struct i40e_vf *vf;
 	int ret = 0;
+	struct hlist_node *h;
 	int bkt;
 
 	/* validate the request */
@@ -2817,7 +2818,7 @@ int i40e_ndo_set_vf_mac(struct net_devic
 	/* 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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/i40e-use-the-safe-hash-table-iterator-when-deleting-mac-filters.patch