datapath: RCU dereference correct pointer in table.
[openvswitch] / datapath / table.c
index 61118090c3fa83e1868990bc49672be47a2a7dad..c6614e13e5c23a3872f7f531115736e5b62c27e3 100644 (file)
@@ -78,7 +78,7 @@ static struct tbl_bucket ***alloc_buckets(unsigned int n_buckets)
        for (i = 0; i < n_buckets >> TBL_L1_BITS; i++) {
                l1[i] = (struct tbl_bucket **)get_zeroed_page(GFP_KERNEL);
                if (!l1[i]) {
-                       free_buckets(l1, i << TBL_L1_BITS, 0);
+                       free_buckets(l1, i << TBL_L1_BITS, NULL);
                        return NULL;
                }
        }
@@ -174,7 +174,7 @@ static int search_bucket(const struct tbl_bucket *bucket, void *target, u32 hash
        int i;
 
        for (i = 0; i < bucket->n_objs; i++) {
-               struct tbl_node *obj = rcu_dereference(bucket->objs[i]);
+               struct tbl_node *obj = bucket->objs[i];
                if (obj->hash == hash && likely(cmp(obj, target)))
                        return i;
        }
@@ -319,7 +319,7 @@ static void free_bucket_rcu(struct rcu_head *rcu)
 int tbl_insert(struct tbl *table, struct tbl_node *target, u32 hash)
 {
        struct tbl_bucket **oldp = find_bucket(table, hash);
-       struct tbl_bucket *old = *rcu_dereference(oldp);
+       struct tbl_bucket *old = rcu_dereference(*oldp);
        unsigned int n = old ? old->n_objs : 0;
        struct tbl_bucket *new = bucket_alloc(n + 1);
 
@@ -357,7 +357,7 @@ int tbl_insert(struct tbl *table, struct tbl_node *target, u32 hash)
 int tbl_remove(struct tbl *table, struct tbl_node *target)
 {
        struct tbl_bucket **oldp = find_bucket(table, target->hash);
-       struct tbl_bucket *old = *rcu_dereference(oldp);
+       struct tbl_bucket *old = rcu_dereference(*oldp);
        unsigned int n = old->n_objs;
        struct tbl_bucket *new;