i40e: fix a bug in debugfs with add/del macaddr
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Thu, 1 Oct 2015 18:37:35 +0000 (14:37 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 23 Oct 2015 11:22:49 +0000 (04:22 -0700)
The new code flow requires us to grab the filter list lock before
adding/deleting the filter.

Change-ID: I4eaef508ab4da2d1b2e23f20f2a78d931d5b6aeb
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_debugfs.c

index d15bd62eb874b11f12b303df98b5d5289c2628f1..d4b7af9a2fc82f8b55878188a0c53a5911d6ddf1 100644 (file)
@@ -1137,7 +1137,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
                        goto command_write_done;
                }
 
+               spin_lock_bh(&vsi->mac_filter_list_lock);
                f = i40e_add_filter(vsi, ma, vlan, false, false);
+               spin_unlock_bh(&vsi->mac_filter_list_lock);
                ret = i40e_sync_vsi_filters(vsi, true);
                if (f && !ret)
                        dev_info(&pf->pdev->dev,
@@ -1174,7 +1176,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
                        goto command_write_done;
                }
 
+               spin_lock_bh(&vsi->mac_filter_list_lock);
                i40e_del_filter(vsi, ma, vlan, false, false);
+               spin_unlock_bh(&vsi->mac_filter_list_lock);
                ret = i40e_sync_vsi_filters(vsi, true);
                if (!ret)
                        dev_info(&pf->pdev->dev,