From: Jesse Gross Date: Wed, 8 Dec 2010 19:07:56 +0000 (-0800) Subject: datapath: Validate access to DP array. X-Git-Tag: v1.1.0~627 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=eb3ccf114ad0780225d4e30315b7aa2dab9e200c;p=sliver-openvswitch.git datapath: Validate access to DP array. When access the array of DPs, we need to hold either rcu_read_lock or dp_mutex. This enables lockdep to validate those conditions. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/datapath.c b/datapath/datapath.c index b44c96792..8960a060e 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -77,7 +77,8 @@ struct datapath *get_dp(int dp_idx) { if (dp_idx < 0 || dp_idx >= ODP_MAX) return NULL; - return rcu_dereference(dps[dp_idx]); + return rcu_dereference_check(dps[dp_idx], rcu_read_lock_held() || + lockdep_is_held(&dp_mutex)); } EXPORT_SYMBOL_GPL(get_dp);