diff --git a/patches.suse/i40e-improve-locking-of-mac_filter_hash.patch b/patches.suse/i40e-improve-locking-of-mac_filter_hash.patch new file mode 100644 index 0000000..62b91c0 --- /dev/null +++ b/patches.suse/i40e-improve-locking-of-mac_filter_hash.patch @@ -0,0 +1,85 @@ +From b0706e5a21bb73b6e5c858ccc24eab53ee450a8b Mon Sep 17 00:00:00 2001 +From: Stefan Assmann +Date: Thu, 4 Mar 2021 10:34:30 +0100 +Subject: [PATCH 7/7] i40e: improve locking of mac_filter_hash +Git-commit: 8b4b06919fd66caf49fdf4fe59f9d6312cf7956d +Patch-mainline: v5.15-rc1 +References: git-fixes + +i40e_config_vf_promiscuous_mode() calls +i40e_getnum_vf_vsi_vlan_filters() without acquiring the +mac_filter_hash_lock spinlock. + +This is unsafe because mac_filter_hash may get altered in another thread +while i40e_getnum_vf_vsi_vlan_filters() traverses the hashes. + +Simply adding the spinlock in i40e_getnum_vf_vsi_vlan_filters() is not +possible as it already gets called in i40e_get_vlan_list_sync() with the +spinlock held. Therefore adding a wrapper that acquires the spinlock and +call the correct function where appropriate. + +Fixes: 37d318d7805f ("i40e: Remove scheduling while atomic possibility") +Fix-suggested-by: Paolo Abeni +Signed-off-by: Stefan Assmann +Tested-by: Konrad Jankowski +Signed-off-by: Tony Nguyen +Signed-off-by: Denis Kirjanov +--- + drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 23 +++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index ec133b017f6b..a166494d249a 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -1133,12 +1133,12 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf) + } + + /** +- * i40e_getnum_vf_vsi_vlan_filters ++ * __i40e_getnum_vf_vsi_vlan_filters + * @vsi: pointer to the vsi + * + * called to get the number of VLANs offloaded on this VF + **/ +-static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) ++static int __i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) + { + struct i40e_mac_filter *f; + u16 num_vlans = 0, bkt; +@@ -1151,6 +1151,23 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) + return num_vlans; + } + ++/** ++ * i40e_getnum_vf_vsi_vlan_filters ++ * @vsi: pointer to the vsi ++ * ++ * wrapper for __i40e_getnum_vf_vsi_vlan_filters() with spinlock held ++ **/ ++static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) ++{ ++ int num_vlans; ++ ++ spin_lock_bh(&vsi->mac_filter_hash_lock); ++ num_vlans = __i40e_getnum_vf_vsi_vlan_filters(vsi); ++ spin_unlock_bh(&vsi->mac_filter_hash_lock); ++ ++ return num_vlans; ++} ++ + /** + * i40e_get_vlan_list_sync + * @vsi: pointer to the VSI +@@ -1168,7 +1185,7 @@ static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans, + int bkt; + + spin_lock_bh(&vsi->mac_filter_hash_lock); +- *num_vlans = i40e_getnum_vf_vsi_vlan_filters(vsi); ++ *num_vlans = __i40e_getnum_vf_vsi_vlan_filters(vsi); + *vlan_list = kcalloc(*num_vlans, sizeof(**vlan_list), GFP_ATOMIC); + if (!(*vlan_list)) + goto err; +-- +2.16.4 + diff --git a/series.conf b/series.conf index 39ab43f..dfecb79 100644 --- a/series.conf +++ b/series.conf @@ -60667,6 +60667,7 @@ patches.suse/0001-dm-crypt-Avoid-percpu_counter-spinlock-contention-in.patch patches.suse/gve-fix-the-wrong-AdminQ-buffer-overflow-check.patch patches.suse/igmp-Add-ip_mc_list-lock-in-ip_check_mc_rcu.patch + patches.suse/i40e-improve-locking-of-mac_filter_hash.patch patches.suse/usb-hso-fix-error-handling-code-of-hso_create_net_de.patch patches.suse/Bluetooth-sco-prevent-information-leak-in-sco_conn_d.patch patches.suse/Bluetooth-increase-BTNAMSIZ-to-21-chars-to-fix-poten.patch