Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964874AbbDZORI (ORCPT ); Sun, 26 Apr 2015 10:17:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41219 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964790AbbDZORE (ORCPT ); Sun, 26 Apr 2015 10:17:04 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pravin Shelar , Thomas Graf , "David S. Miller" Subject: [PATCH 3.19 08/27] openvswitch: Return vport module ref before destruction Date: Sun, 26 Apr 2015 16:15:39 +0200 Message-Id: <20150426134603.735937500@linuxfoundation.org> X-Mailer: git-send-email 2.3.6 In-Reply-To: <20150426134603.371719585@linuxfoundation.org> References: <20150426134603.371719585@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1557 Lines: 48 3.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Graf [ Upstream commit fa2d8ff4e3522b4e05f590575d3eb8087f3a8cdc ] Return module reference before invoking the respective vport ->destroy() function. This is needed as ovs_vport_del() is not invoked inside an RCU read side critical section so the kfree can occur immediately before returning to ovs_vport_del(). Returning the module reference before ->destroy() is safe because the module unregistration is blocked on ovs_lock which we hold while destroying the datapath. Fixes: 62b9c8d0372d ("ovs: Turn vports with dependencies into separate modules") Reported-by: Pravin Shelar Signed-off-by: Thomas Graf Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/openvswitch/vport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport) ASSERT_OVSL(); hlist_del_rcu(&vport->hash_node); - - vport->ops->destroy(vport); - module_put(vport->ops->owner); + vport->ops->destroy(vport); } /** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/