iavf: fix potential races for FDIR filters
authorPiotr Gardocki <piotrx.gardocki@intel.com>
Mon, 7 Aug 2023 20:50:11 +0000 (13:50 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 8 Aug 2023 23:38:28 +0000 (16:38 -0700)
commit0fb1d8eb234b6979d4981d2d385780dd7d8d9771
treeafa3a1465706ee36f09eb5c8f57ea05491a1cc88
parent06b412589eef780b792e73df131d35dc43cc4a49
iavf: fix potential races for FDIR filters

Add fdir_fltr_lock locking in unprotected places.

The change in iavf_fdir_is_dup_fltr adds a spinlock around a loop which
iterates over all filters and looks for a duplicate. The filter can be
removed from list and freed from memory at the same time it's being
compared. All other places where filters are deleted are already
protected with spinlock.

The remaining changes protect adapter->fdir_active_fltr variable so now
all its uses are under a spinlock.

Fixes: 527691bf0682 ("iavf: Support IPv4 Flow Director filters")
Signed-off-by: Piotr Gardocki <piotrx.gardocki@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807205011.3129224-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/iavf/iavf_ethtool.c
drivers/net/ethernet/intel/iavf/iavf_fdir.c