datapath: Fix ODP_PORT_GROUP_GET implementation.
authorBen Pfaff <blp@nicira.com>
Tue, 25 May 2010 22:42:44 +0000 (15:42 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 25 May 2010 22:42:48 +0000 (15:42 -0700)
The final argument to do_get_port_group() is supposed to be a user pointer
to the number of ports, to be updated with put_user(), but it was actually
a kernel pointer, so "ovs-dpctl dump-groups" and anything else that used
this ioctl would always fail with -EFAULT.  This commit fixes it.

Bug introduced in commit 44e05eca "datapath: Prepare to support 32-bit
compatibility ioctls" for normal ioctls and for compat ioctls at their
introduction in commit 3fbd517acf"datapath: Add 32-bit compatibility
ioctls."

datapath/datapath.c

index 1d007b0..fd63fb0 100644 (file)
@@ -1576,7 +1576,7 @@ static int get_port_group(struct datapath *dp, struct odp_port_group __user *upg
        if (copy_from_user(&pg, upg, sizeof pg))
                return -EFAULT;
 
-       return do_get_port_group(dp, pg.ports, pg.n_ports, pg.group, &pg.n_ports);
+       return do_get_port_group(dp, pg.ports, pg.n_ports, pg.group, &upg->n_ports);
 }
 
 static int get_listen_mask(const struct file *f)
@@ -1794,7 +1794,7 @@ static int compat_get_port_group(struct datapath *dp, struct compat_odp_port_gro
                return -EFAULT;
 
        return do_get_port_group(dp, compat_ptr(pg.ports), pg.n_ports,
-                                pg.group, &pg.n_ports);
+                                pg.group, &upg->n_ports);
 }
 
 static int compat_get_flow(struct odp_flow *flow, const struct compat_odp_flow __user *compat)