]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
openvswitch: fix flow command message size
authorPaolo Abeni <pabeni@redhat.com>
Tue, 26 Nov 2019 11:55:50 +0000 (12:55 +0100)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:23:05 +0000 (14:23 -0300)
BugLink: https://bugs.launchpad.net/bugs/1855306
[ Upstream commit 4e81c0b3fa93d07653e2415fa71656b080a112fd ]

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.

Fixes: 74ed7ab9264c ("openvswitch: Add support for unique flow IDs.")
Reported-by: Qi Jun Ding <qding@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/openvswitch/datapath.c

index 43aeca12208cb4cd1cf8ec42cd8be00bd3611bc1..b3702b9b303f2546e73314af85d47a4651906442 100644 (file)
@@ -701,9 +701,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))