summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2019-11-26 12:55:50 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 15:38:16 +0100
commit0e32df103ca66a9efce43c6100bb0f8d973f24b6 (patch)
treed19c32d4ea4e67f902f7dc742be53725ae36f21e /net
parent4b61349a540d0b3a2f6133a4bc16239cf24820c5 (diff)
downloadlinux-stable-0e32df103ca66a9efce43c6100bb0f8d973f24b6.tar.gz
linux-stable-0e32df103ca66a9efce43c6100bb0f8d973f24b6.tar.bz2
linux-stable-0e32df103ca66a9efce43c6100bb0f8d973f24b6.zip
openvswitch: fix flow command message size
[ 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>
Diffstat (limited to 'net')
-rw-r--r--net/openvswitch/datapath.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 2de2a923ff2b..33b0fc5c33c8 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -724,9 +724,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))