summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-09-20 10:31:29 -0700
committerJesse Gross <jesse@nicira.com>2011-09-20 15:17:09 -0700
commitd48c88ecdbab481a210a1d02a616a30ee261cabf (patch)
tree64abe1a1c34a989f5fcc5a8d7796f39a175df6c7
parent96871912a16c25bdc18bb22db79485b0fa80a87d (diff)
downloadopenvswitch-d48c88ecdbab481a210a1d02a616a30ee261cabf.tar.gz
datapath: Correctly validate vport attributes on old kernels.
The vport policy for OVS_VPORT_ATTR_PORT_NO and OVS_VPORT_ATTR_TYPE are present only in the section for newer kernels. This means that on older kernels the length of these attributes are never checked anywhere but we go ahead and read from them anyways. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--datapath/datapath.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 4be1d90e4..5fcf81ba3 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -1535,14 +1535,14 @@ static struct genl_ops dp_datapath_genl_ops[] = {
static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
#ifdef HAVE_NLA_NUL_STRING
[OVS_VPORT_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 },
- [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
- [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
[OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) },
[OVS_VPORT_ATTR_ADDRESS] = { .len = ETH_ALEN },
#else
[OVS_VPORT_ATTR_STATS] = { .minlen = sizeof(struct ovs_vport_stats) },
[OVS_VPORT_ATTR_ADDRESS] = { .minlen = ETH_ALEN },
#endif
+ [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
+ [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
[OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
};