From 65d9d5f8b8fd548f411c512e946cf2408182a1d4 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 25 May 2010 15:42:44 -0700 Subject: [PATCH] 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." --- datapath/datapath.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 1d007b04..fd63fb02 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) -- 2.30.2