datapath: Use get_table_protected() in additional places.
authorJesse Gross <jesse@nicira.com>
Sat, 25 Dec 2010 03:44:34 +0000 (19:44 -0800)
committerJesse Gross <jesse@nicira.com>
Wed, 29 Dec 2010 18:29:48 +0000 (10:29 -0800)
There are several places where the flow table is accessed
without any kind of RCU protection.  This is fine because dp
mutex is held so this adds checks for that condition.

Found with sparse.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/datapath.c

index 2be0ce1..bf9fc82 100644 (file)
@@ -286,7 +286,7 @@ static int create_dp(int dp_idx, const char __user *devnamep)
 err_destroy_local_port:
        dp_detach_port(dp->ports[ODPP_LOCAL]);
 err_destroy_table:
-       tbl_destroy(dp->table, NULL);
+       tbl_destroy(get_table_protected(dp), NULL);
 err_free_dp:
        kfree(dp);
 err_put_module:
@@ -312,8 +312,7 @@ static void do_destroy_dp(struct datapath *dp)
        rcu_assign_pointer(dps[dp->dp_idx], NULL);
 
        dp_detach_port(dp->ports[ODPP_LOCAL]);
-
-       tbl_destroy(dp->table, flow_free_tbl);
+       tbl_destroy(get_table_protected(dp), flow_free_tbl);
 
        for (i = 0; i < DP_N_QUEUES; i++)
                skb_queue_purge(&dp->queues[i]);