From: Jesse Gross Date: Wed, 8 Dec 2010 20:02:42 +0000 (-0800) Subject: datapath: dp_sysfs_add_dp() needs RTNL lock. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dad80ec3088c787d3fd876e8d3d11ad7b3f0f11b;p=openvswitch datapath: dp_sysfs_add_dp() needs RTNL lock. We currently drop RTNL before adding a new datapath to sysfs but then access the dp data structures. This moves the call to dp_sysfs_add_dp() before we drop the locks to prevent a potential race. All other calls to sysfs functions already hold RTNL. Found with lockdep. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 65d25c2a..08e7450e 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -267,11 +267,11 @@ static int create_dp(int dp_idx, const char __user *devnamep) goto err_destroy_local_port; rcu_assign_pointer(dps[dp_idx], dp); + dp_sysfs_add_dp(dp); + mutex_unlock(&dp_mutex); rtnl_unlock(); - dp_sysfs_add_dp(dp); - return 0; err_destroy_local_port: