i40e: use the safe hash table iterator when deleting mac filters
authorLihong Yang <lihong.yang@intel.com>
Thu, 7 Sep 2017 12:05:46 +0000 (08:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:26:26 +0000 (14:26 +0100)
commitc817cb56b8d62cf2677988cf5fa70cc515a526e1
tree381606b98022244f99ab45d2d0b8519d7f4e8a70
parent66efe26b0b074ef11575b883fc9a93af51aab597
i40e: use the safe hash table iterator when deleting mac filters

[ 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

Signed-off-by: Lihong Yang <lihong.yang@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c