[ovs-dev] Prevent kernel warning length of ovs attribute.

Message ID 1544627203-347-1-git-send-email-nathanael.davison@citrix.com
State New
Headers show
Series
  • [ovs-dev] Prevent kernel warning length of ovs attribute.
Related show

Commit Message

Nathanael Davison Dec. 12, 2018, 3:06 p.m.
Linux kernel commit 6e237d099fac introduced warnings when validating the
length of some types. This exposed a bug in dpif-netlink.c
dpif_netlink_vport_to_ofpbuf where ovs was passing the upcall pids as
variable length array while the kernel was expecting a single u32. This
resulted in the kernel reporting "netlink: 'ovs-vswitchd': attribute
type 5 has an invalid length.".

This patch changes the kernel to expect NLA_UNSPEC, which is for
arbitrary length data.

Signed-off-by: Nathanael Davison <nathanael.davison@citrix.com>
---
 datapath/datapath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/datapath/datapath.c b/datapath/datapath.c
index e3d3c8c..3204bf3 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -2170,7 +2170,7 @@  static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
 	[OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) },
 	[OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
 	[OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
-	[OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_U32 },
+	[OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_UNSPEC },
 	[OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
 };