From patchwork Fri Dec 21 13:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin-Gabriel Serdean X-Patchwork-Id: 1017530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43LqsT083Zz9sDL for ; Sat, 22 Dec 2018 00:55:56 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id B1222E1A; Fri, 21 Dec 2018 13:55:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9AD12E19 for ; Fri, 21 Dec 2018 13:55:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id F3A362C4 for ; Fri, 21 Dec 2018 13:55:51 +0000 (UTC) X-Originating-IP: 89.46.161.178 Received: from localhost.localdomain (unknown [89.46.161.178]) (Authenticated sender: aserdean@ovn.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id D97B4240004; Fri, 21 Dec 2018 13:55:49 +0000 (UTC) From: Alin Gabriel Serdean To: dev@openvswitch.org Date: Fri, 21 Dec 2018 15:55:27 +0200 Message-Id: <20181221135527.42024-1-aserdean@ovn.org> X-Mailer: git-send-email 2.16.1.windows.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Alin Gabriel Serdean Subject: [ovs-dev] [PATCH] datapath-windows: Fix race condition when deleting internal ports X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org We need to hold the port lock until all the operations with a port are completed. Found by inspection. Signed-off-by: Alin Gabriel Serdean Acked-by: Ben Pfaff Acked-by: Anand Kumar --- datapath-windows/ovsext/Vport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c index 380870a11..e08cb90ce 100644 --- a/datapath-windows/ovsext/Vport.c +++ b/datapath-windows/ovsext/Vport.c @@ -632,13 +632,13 @@ HvDisconnectNic(POVS_SWITCH_CONTEXT switchContext, OvsRemoveAndDeleteVport(NULL, switchContext, vport, FALSE, TRUE); OvsPostVportEvent(&event); } - NdisReleaseRWLock(switchContext->dispatchLock, &lockState); if (isInternalPort) { OvsInternalAdapterDown(vport->portNo, vport->netCfgInstanceId); OvsRemoveAndDeleteVport(NULL, switchContext, vport, TRUE, TRUE); OvsPostVportEvent(&event); } + NdisReleaseRWLock(switchContext->dispatchLock, &lockState); done: VPORT_NIC_EXIT(nicParam);