From patchwork Wed May 31 02:12:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 768860 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wcvTM0G6tz9s7h for ; Wed, 31 May 2017 12:25:27 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.b="TKK1rWoy"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8A0AD89B74; Wed, 31 May 2017 02:25:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sqT1pMuuH0k0; Wed, 31 May 2017 02:25:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 25BBB89B5D; Wed, 31 May 2017 02:25:24 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 0DD2B1C14F8 for ; Wed, 31 May 2017 02:25:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 02DAB87399 for ; Wed, 31 May 2017 02:25:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ae5vz4DPllya for ; Wed, 31 May 2017 02:25:21 +0000 (UTC) X-Greylist: delayed 00:15:08 by SQLgrey-1.7.6 Received: from m12-17.163.com (m12-17.163.com [220.181.12.17]) by fraxinus.osuosl.org (Postfix) with ESMTP id BD9A28738D for ; Wed, 31 May 2017 02:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=og94CC1zyiztUTbCxB NZy3LLbnD4LCoFtsIKHhqrpoA=; b=TKK1rWoy5tYc3cYzizu/Cx13OmcFEWf1vd h8eJZHJbPVBlDyKJolgwqauzLMm29aUsn8GgBOly5MvGTX0uROMjnQw8qZ+ghqV9 r2UvQBo7N3p5YG2zb0czR7cUMmMx1SM170RpIJ7Ax+HbCpagkKQThklgO1N/4VWk 0tySg6uEw= Received: from bai-oslab.tsinghua.edu.cn (unknown [166.111.70.19]) by smtp13 (Coremail) with SMTP id EcCowAAXH1P4JS5ZBgWFHQ--.42304S2; Wed, 31 May 2017 10:10:04 +0800 (CST) From: Jia-Ju Bai To: jeffrey.t.kirsher@intel.com Date: Wed, 31 May 2017 10:12:11 +0800 Message-Id: <1496196731-748-1-git-send-email-baijiaju1990@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: EcCowAAXH1P4JS5ZBgWFHQ--.42304S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7XryfCw18tFy5uFWUAr1DKFg_yoW8JF45p3 yjqa45ur4kXws8W3y7Ja18uFZ5Ww4kK34YganxC3s8uFs8tFs5XF47KFy7C340vrWkGFsx Xr1DZr15Crs8AaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRZYFNUUUUU= X-Originating-IP: [166.111.70.19] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbipRvoelUMFBU+PgAAs0 Cc: netdev@vger.kernel.org, Jia-Ju Bai , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: [Intel-wired-lan] [PATCH] i40e: Fix a sleep-in-atomic bug X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 95c23fb..0fb38ca 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -3017,10 +3017,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, 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",