From: Ben Pfaff Date: Tue, 25 May 2010 22:42:44 +0000 (-0700) Subject: datapath: Fix ODP_PORT_GROUP_GET implementation. X-Git-Tag: v1.0.1~31 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=65d9d5f8b8fd548f411c512e946cf2408182a1d4;p=sliver-openvswitch.git datapath: Fix ODP_PORT_GROUP_GET implementation. 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." --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 1d007b04b..fd63fb02b 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -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)