From: Jia-Ju Bai Date: Wed, 14 Jun 2017 23:35:31 +0000 (-0700) Subject: i40e: Fix a sleep-in-atomic bug X-Git-Tag: v4.1.12-117.0_27200813_3~255 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=28de6febba890481b79fa32705f23c6f5e6dd448;p=users%2Fjedix%2Flinux-maple.git i40e: Fix a sleep-in-atomic bug The driver may sleep under a spin lock, and the function call path is: i40e_ndo_set_vf_port_vlan (acquire the lock by spin_lock_bh) i40e_vsi_remove_pvid i40e_vlan_stripping_disable i40e_aq_update_vsi_params i40e_asq_send_command mutex_lock --> may sleep To fixed it, the spin lock is released before "i40e_vsi_remove_pvid", and the lock is acquired again after this function. Signed-off-by: Jia-Ju Bai Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller Orabug: 26785018 (cherry picked from commit 640f93cc6ea7327588be3cc0849d1342aac0393a) Signed-off-by: Jack Vogel Reviewed-by: Kyle Fortin --- diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 5f4a42d63801..92a6a3105915 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -3003,10 +3003,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, VLAN_VID_MASK)); } + spin_unlock_bh(&vsi->mac_filter_hash_lock); if (vlan_id || qos) ret = i40e_vsi_add_pvid(vsi, vlanprio); else i40e_vsi_remove_pvid(vsi); + spin_lock_bh(&vsi->mac_filter_hash_lock); if (vlan_id) { dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",