From patchwork Wed Dec 12 15:06:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathanael Davison X-Patchwork-Id: 1012045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=citrix.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43FL1P6ndbz9sB7 for ; Thu, 13 Dec 2018 02:13:45 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5AAAECC8; Wed, 12 Dec 2018 15:13:42 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id A7918C6D for ; Wed, 12 Dec 2018 15:13:41 +0000 (UTC) X-Greylist: delayed 00:06:55 by SQLgrey-1.7.6 Received: from localhost.localdomain (unknown [185.25.67.249]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 17A9E815 for ; Wed, 12 Dec 2018 15:13:41 +0000 (UTC) Received: by localhost.localdomain (Postfix, from userid 0) id 4C57B47D585; Wed, 12 Dec 2018 15:06:45 +0000 (UTC) From: Nathanael Davison To: ovs-dev@openvswitch.org Date: Wed, 12 Dec 2018 15:06:43 +0000 Message-Id: <1544627203-347-1-git-send-email-nathanael.davison@citrix.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RDNS_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Nathanael Davison Subject: [ovs-dev] [PATCH] Prevent kernel warning length of ovs attribute. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 --- 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 }, };