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

Nathanael Davison nathanael.davison at citrix.com
Wed Dec 12 15:06:43 UTC 2018


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 at citrix.com>
---
 datapath/datapath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 },
 };
 
-- 
1.8.3.1



More information about the dev mailing list