aboutsummaryrefslogtreecommitdiff
path: root/datapath/dp_sysfs_if.c
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-12-05 11:22:04 -0800
committerJesse Gross <jesse@nicira.com>2010-12-13 13:40:27 -0800
commitad9197112ae58f338491e6344a9f66073e4bce95 (patch)
tree5bb7cd5ccbae464ec1e2f6f9b8bac3b8aba56242 /datapath/dp_sysfs_if.c
parent8dda8c9b63c8803621f900beaa397c673b736197 (diff)
datapath: Don't directly access RCU protected pointers.
If RTNL lock is used to protected updates to RCU data structures then it isn't necessary to use rcu_dereference() to access them if RTNL is held. This adds rtnl_dereference() to access these pointers which has several benefits: documents the locking expectations; checks that RTNL actually is held when run with lockdep; makes sparse not complain about directly accessing RCU pointers. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath/dp_sysfs_if.c')
-rw-r--r--datapath/dp_sysfs_if.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/datapath/dp_sysfs_if.c b/datapath/dp_sysfs_if.c
index fc7c2d8e..c688bc4b 100644
--- a/datapath/dp_sysfs_if.c
+++ b/datapath/dp_sysfs_if.c
@@ -220,8 +220,9 @@ int dp_sysfs_add_if(struct vport *p)
/* Create symlink from /sys/class/net/<devname>/brport/bridge to
* /sys/class/net/<bridgename>. */
- err = sysfs_create_link(&p->kobj, vport_get_kobj(dp->ports[ODPP_LOCAL]),
- SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
+ err = sysfs_create_link(&p->kobj,
+ vport_get_kobj(rtnl_dereference(dp->ports[ODPP_LOCAL])),
+ SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
if (err)
goto err_del;