]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath: Correctly return error if percpu allocation fails.
authorJesse Gross <jesse@nicira.com>
Mon, 13 Dec 2010 23:21:28 +0000 (15:21 -0800)
committerJesse Gross <jesse@nicira.com>
Tue, 14 Dec 2010 00:08:23 +0000 (16:08 -0800)
If the allocation of percpu stats fails when creating a new
datapath, we currently don't return the correct error code.  Since
we don't explicitly set it when the allocation fails it will keep
the value from the previous call.  This means we will return success
when the creation actually failed.

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

index 0205fd267070760e91b67266486ba2c844801cb8..fded95ce191cc157e0b3e7c06864816d73d60491 100644 (file)
@@ -270,8 +270,10 @@ static int create_dp(int dp_idx, const char __user *devnamep)
 
        dp->drop_frags = 0;
        dp->stats_percpu = alloc_percpu(struct dp_stats_percpu);
-       if (!dp->stats_percpu)
+       if (!dp->stats_percpu) {
+               err = -ENOMEM;
                goto err_destroy_local_port;
+       }
 
        rcu_assign_pointer(dps[dp_idx], dp);
        dp_sysfs_add_dp(dp);