[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <7df4df3b89d405b3f01b6e637a52321bf36d37d4.1574769169.git.pabeni@redhat.com>
Date: Tue, 26 Nov 2019 12:55:50 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Joe Stringer <joestringer@...ira.com>,
Pravin B Shelar <pshelar@....org>
Subject: [PATCH net] openvswitch: fix flow command message size
When user-space sets the OVS_UFID_F_OMIT_* flags, and the relevant
flow has no UFID, we can exceed the computed size, as
ovs_nla_put_identifier() will always dump an OVS_FLOW_ATTR_KEY
attribute.
Take the above in account when computing the flow command message
size.
Reported-by: Qi Jun Ding <qding@...hat.com>
Fixes: 74ed7ab9264c ("openvswitch: Add support for unique flow IDs.")
Signed-off-by: Paolo Abeni <pabeni@...hat.com>
---
net/openvswitch/datapath.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 50656e807c8c..928e580c8cc9 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -704,9 +704,13 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts,
{
size_t len = NLMSG_ALIGN(sizeof(struct ovs_header));
- /* OVS_FLOW_ATTR_UFID */
+ /* OVS_FLOW_ATTR_UFID, or unmasked flow key as fallback
+ * see ovs_nla_put_identifier()
+ */
if (sfid && ovs_identifier_is_ufid(sfid))
len += nla_total_size(sfid->ufid_len);
+ else
+ len += nla_total_size(ovs_key_attr_size());
/* OVS_FLOW_ATTR_KEY */
if (!sfid || should_fill_key(sfid, ufid_flags))
--
2.21.0
Powered by blists - more mailing lists