From: Ben Pfaff Date: Tue, 30 Dec 2008 19:23:36 +0000 (-0800) Subject: Use rcu_dereference() before we dereference an RCU-protected pointer. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ed3226c56bfe4b32e0cc2751368fcd12f9cac73;p=openvswitch Use rcu_dereference() before we dereference an RCU-protected pointer. The access to dps[i]->netdev->name is a dereference that should be protected by rcu_dereference(). --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 2677445f..5e1e70ad 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1140,8 +1140,9 @@ struct datapath *dp_get_by_name(const char *dp_name) return NULL; for (i=0; inetdev->name, dp_name, IFNAMSIZ)) - return rcu_dereference(dps[i]); + struct datapath *dp = rcu_dereference(dps[i]); + if (dp && !strncmp(dp->netdev->name, dp_name, IFNAMSIZ)) + return dp; } return NULL; }