From patchwork Mon Oct 12 20:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1381144 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.133; helo=hemlock.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=q1ji+lhL; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C99DP5WCKz9sTf for ; Tue, 13 Oct 2020 07:25:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 28A6687943; Mon, 12 Oct 2020 20:25:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GX6-Kwb3jxYn; Mon, 12 Oct 2020 20:25:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id A4B7C879C5; Mon, 12 Oct 2020 20:25:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92F05C1DA2; Mon, 12 Oct 2020 20:25:37 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id BD2D6C0052 for ; Mon, 12 Oct 2020 20:25:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A153486B8D for ; Mon, 12 Oct 2020 20:25:36 +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 b7RAbmFZmyEx for ; Mon, 12 Oct 2020 20:25:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 576C48689C for ; Mon, 12 Oct 2020 20:25:32 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id j7so4736866pgk.5 for ; Mon, 12 Oct 2020 13:25:32 -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=IwcnNvfPu+9e4OCOe/HwV0GV1zew87r13Eo4HA4wBBw=; b=q1ji+lhLQSojd7Zg0GluNk9UU9z3U7ZasarFk25V+zLKC6n5oQhzaoBcwiQ6zX3gp1 w2zB+7F98jWC5OlXCZK4i4ibc3HlcySCsBx/KYoPknrsSORsJI88ho1hJ90OIsvRw1pM oqAy6qx4rsTr08jdk4wihu9oT47fFxxdYqEwpACOSytoAYBJFxdFmD6V8vtm69xbTCKN 2p8PD5sIX6Jc3ApxpvjHhyQOEMdv7E5zA0nAvAJLDnnv3iaantftygIwsThzWh6YFeg+ gSfwga+6yERu1jhfe0LL9O3Z92gK7qRbxGy0VVuLQBcdLYlkaMa/oOUgB+prZGP9FMnM VFxQ== 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=IwcnNvfPu+9e4OCOe/HwV0GV1zew87r13Eo4HA4wBBw=; b=uFINOkpMuCHt5z7yDnRBS0rCaSgCX7+w2M6tWdsKSnao1QRxYoBhZztrgoK0p0QTTd CERK69wHuWxRfWd2y8kdNZ1B4Nd+SMa0c5Cj6LmTqyCQIXUDnxHG03GsjY3a5zOBuZ5/ /gfH8WQYmD1AVHVWbArXbQj8EcsrEPOQC7rqgIaFqIBhQFFuHxygbaPsCjA5QfqFtqzT w2bpEVSpOeySLd1A9fr28Zugsy/kCN3kYMywoBnBK99zd8NzkAPXn/G0/JjR5Gayhste JL3lnUk08MvId+ms3Z3ABLL6CAmEX/RtKAn3VtKv/fK/nrGkJsFg/cytEfpLA7d2MDN+ Y2fg== X-Gm-Message-State: AOAM533MzMLPuOh/HYLLdmlhpgYR09BfE06HINol6Mqs6jH/iEvuCJz1 Mh5dQfy08f6twjFmX0T00XueQ2iVHHCknQ== X-Google-Smtp-Source: ABdhPJzpiLTBsxR3YRu/RPF+5FMlVana1IIzDJnKTDVwm8TfjRHl7Y9O+NCGc4RxTzbr8T4vaNyl+w== X-Received: by 2002:a63:1b57:: with SMTP id b23mr13913563pgm.81.1602534331559; Mon, 12 Oct 2020 13:25:31 -0700 (PDT) Received: from VMware-box.domain (97-115-80-55.ptld.qwest.net. [97.115.80.55]) by smtp.googlemail.com with ESMTPSA id w135sm11384421pfc.103.2020.10.12.13.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 13:25:31 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Mon, 12 Oct 2020 13:25:02 -0700 Message-Id: <20201012202511.21000-16-gvrose8192@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012202511.21000-1-gvrose8192@gmail.com> References: <20201012202511.21000-1-gvrose8192@gmail.com> Cc: Paolo Abeni Subject: [ovs-dev] [PATCH V4 15/24] 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 ddc0b4491..1020fee41 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))