From patchwork Thu Aug 20 22:49:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1348670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=u8n+eiEK; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXfzK0LqLz9sPB for ; Fri, 21 Aug 2020 08:51:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 91F5586C2B; Thu, 20 Aug 2020 22:51:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Axjs0Y_1ywr; Thu, 20 Aug 2020 22:51:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id C4AB186BA3; Thu, 20 Aug 2020 22:51:52 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B8DD7C0894; Thu, 20 Aug 2020 22:51:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8D859C0051 for ; Thu, 20 Aug 2020 22:51:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 50FAE22B20 for ; Thu, 20 Aug 2020 22:51:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hQ4cf7m4AiYE for ; Thu, 20 Aug 2020 22:51:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by silver.osuosl.org (Postfix) with ESMTPS id 8C04622C51 for ; Thu, 20 Aug 2020 22:50:29 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id kr4so93109pjb.2 for ; Thu, 20 Aug 2020 15:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7awIBLTMVn7gn5J/owbZt6uiaZGm0ko5Fdgz76OonQI=; b=u8n+eiEKy0+gj6WkpqNvgK5F3Y64yHGTv9KLDlv9R4b0RsKdVb2eLA2e5GOQqGsf8O gGNMudyjM9wV/LXVvLT+V8DaAZ/rX+LukKYm2GQ7vNPxLqi03QiVio/iGXkBCl98LEGo hP+xDqZNUyPeoI6lmaSHAt1W7SBnTyVrcL4Zl7lS0GcD0gYbeK63yo6FBCYQxXjZoYqd 2QTEhzA2/l4xG6xtnm8Z6qt0y2mNxu9htwJ5JtlgzRXOXnBLrwNiLgI3chvlBqNN2H2m a8aCvSdzKWbcpU20FVe3A7qphfg4+640/fb61cEPDsyv7lmxdUOX0FcA2DUL59Yi4QTF eAAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7awIBLTMVn7gn5J/owbZt6uiaZGm0ko5Fdgz76OonQI=; b=EsVQVaJS3p7Jsq471GpFcUzixWwiruFR8wWDhmzxvFqPKLm0ThvGmGJwX4BeUC0aVG 9EkDCpVHbPQQIcdIpKhUcyJlx7297rqMmbgh1mYH4wLDe4T25ddDhbMpkANqfjBCvhHy eDvsPlP1BWusRauoQZMAdqdHlQ7cGHzAOzuC4efxDbuP74SnKDdvpygSjguvLhrrg2AE Fx+mk7fXkOuUvfvIbd4DvGnTrxPStcK4Dlbap0wnusuKPpPNm8cZHubz6mCrXRkulwsr YoJ1wWWVnBwbNynKlHNXBCK3TVNmz5pFXveztIxZurDhR0Vb663VqVgmgrmTZBJPEmQZ dvAg== X-Gm-Message-State: AOAM532RAy7+Pzj2Xxo3zPXLAVPwvo4IbSbnTQ7kDeRVyY3PU6CZMFZ0 3k2ZCz78wX9cvWlxshXVNGVjK/4w4q+dXg== X-Google-Smtp-Source: ABdhPJxRz0GkbwhfNQDAYvvWAMJtZlt3jPdqUXmcDFnacp/EH54LOqWajAc+XuzbmXYHPcShoWa7eQ== X-Received: by 2002:a17:90a:aa90:: with SMTP id l16mr17609pjq.210.1597963828536; Thu, 20 Aug 2020 15:50:28 -0700 (PDT) Received: from gizo.domain (97-115-99-106.ptld.qwest.net. [97.115.99.106]) by smtp.gmail.com with ESMTPSA id y6sm116866pfr.61.2020.08.20.15.50.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 15:50:27 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Thu, 20 Aug 2020 15:49:43 -0700 Message-Id: <1597963790-12362-17-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> References: <1597963790-12362-1-git-send-email-gvrose8192@gmail.com> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH 16/23] datapath: fix flow command message size X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Paolo Abeni Upstream commit: commit 4e81c0b3fa93d07653e2415fa71656b080a112fd Author: Paolo Abeni Date: Tue Nov 26 12:55:50 2019 +0100 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: 74ed7ab9264c ("openvswitch: Add support for unique flow IDs.") Reported-by: Qi Jun Ding Signed-off-by: Paolo Abeni Signed-off-by: David S. Miller Cc: Paolo Abeni Signed-off-by: Greg Rose --- datapath/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index b9ac676..047b331 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -763,9 +763,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))