Skip to content

Commit 4e81c0b

Browse files
Paolo Abenidavem330
authored andcommitted
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. Fixes: 74ed7ab ("openvswitch: Add support for unique flow IDs.") Reported-by: Qi Jun Ding <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 786c4a5 commit 4e81c0b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/openvswitch/datapath.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,13 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts,
723723
{
724724
size_t len = NLMSG_ALIGN(sizeof(struct ovs_header));
725725

726-
/* OVS_FLOW_ATTR_UFID */
726+
/* OVS_FLOW_ATTR_UFID, or unmasked flow key as fallback
727+
* see ovs_nla_put_identifier()
728+
*/
727729
if (sfid && ovs_identifier_is_ufid(sfid))
728730
len += nla_total_size(sfid->ufid_len);
731+
else
732+
len += nla_total_size(ovs_key_attr_size());
729733

730734
/* OVS_FLOW_ATTR_KEY */
731735
if (!sfid || should_fill_key(sfid, ufid_flags))

0 commit comments

Comments
 (0)