Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp60280lfe; Fri, 15 Apr 2022 19:30:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY8FZ3zQNQeCIlXr5fHd352THLrhIWHI8hDAhRtBSD4RhRj7lMMszPOnmdCMAKEz633VTv X-Received: by 2002:a17:90b:4a46:b0:1c7:3b81:fc6 with SMTP id lb6-20020a17090b4a4600b001c73b810fc6mr1792458pjb.243.1650076205061; Fri, 15 Apr 2022 19:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650076205; cv=none; d=google.com; s=arc-20160816; b=0V08ml8xISEWsLfImOTCyxuINL9GKke1wzMREJHbr/+tq3lmKjQZ4YeoCznIH35Bcp 2oAJajDAaRlEmklv6fiSvW+D8xiZqbkS9+V4tpEQIhnSXTXDrsIW/fapTwS2qVVozU+O Vuuet4uHayeSteKL3tjkFYXD3rRurJz0oJuGdilXEl13Z3Gi9CAuOzFNJy/clIbXBUTw Mp+kP+rCWvsWV6d/rQlcGJfamhNTSZRTCDAPLcrJrJ4kAHLMR4y+AJgIC9Kwka1ICCDh JzujLX59SH4CQHTgNll9tHAwwsCTzkjj3UTvOwwLpCgZdyNHTXmEdUY7V606owUhazlw 9+ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jP/lsaqwytKA1y1/KIE6rvJAbLXOGnu1smEeOxchS1o=; b=LMLcbAS+t3yw7jRBWzOkmqX9bWKYkIKJ5MYnYtUjPxenG+AHt5R4RuXeUoDfQX2JcV BdhbNnnWc0I16SMNx4n/mlXnkw0xCbzq/hRBotH94A+Y5g+SUpCzMkKx8EY1KSIWnHpt OGnNbsbLBgm2ukzxPe67BL1J1ruOGcvSoyLnBxotmURIn3H9GA0ioP2XbYL3Kh7KFpTL 5LJoLhefBhLjvn1D0doXOayssgytdW9NPXHn4YuL8YDw2GoENNFLMco7RAwlY4Iq8/A/ g/Fhu7Bruft9d+HVbRxvybLi6RMXVsLguqe3GgnTayY9jPNSufCF723owkDtJdQhSLIJ Zu2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DmIjMzju; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m24-20020a170902bb9800b00154a68405d3si2805242pls.134.2022.04.15.19.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DmIjMzju; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09C8E29D31E; Fri, 15 Apr 2022 18:44:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346167AbiDNN4C (ORCPT + 99 others); Thu, 14 Apr 2022 09:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344189AbiDNNbF (ORCPT ); Thu, 14 Apr 2022 09:31:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725BBE6; Thu, 14 Apr 2022 06:28:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35608B82984; Thu, 14 Apr 2022 13:28:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EB18C385A5; Thu, 14 Apr 2022 13:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649942918; bh=qSayJhxGXTLXW2afgOno1/qZon/DBb4zO2hFrDAy1H0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DmIjMzjujQ44RG5+liX2y+qFHwjvwzP8E26/oEkisg0fRKqyoGwK4vHQrIP2qmSNf Z9C+t7C/pjfFWFqFky+i5x7h4T10No3cZcbRZOMmo1D2SNhKyx9EG54wlD3nhSug6e SXxdbCNSFi5zN1OCEYBNgXsOkqW/uX5DzsocKTrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Maximets , Aaron Conole , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 308/338] net: openvswitch: dont send internal clone attribute to the userspace. Date: Thu, 14 Apr 2022 15:13:31 +0200 Message-Id: <20220414110847.647701636@linuxfoundation.org> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220414110838.883074566@linuxfoundation.org> References: <20220414110838.883074566@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilya Maximets [ Upstream commit 3f2a3050b4a3e7f32fc0ea3c9b0183090ae00522 ] 'OVS_CLONE_ATTR_EXEC' is an internal attribute that is used for performance optimization inside the kernel. It's added by the kernel while parsing user-provided actions and should not be sent during the flow dump as it's not part of the uAPI. The issue doesn't cause any significant problems to the ovs-vswitchd process, because reported actions are not really used in the application lifecycle and only supposed to be shown to a human via ovs-dpctl flow dump. However, the action list is still incorrect and causes the following error if the user wants to look at the datapath flows: # ovs-dpctl add-dp system@ovs-system # ovs-dpctl add-flow "" "clone(ct(commit),0)" # ovs-dpctl dump-flows , packets:0, bytes:0, used:never, actions:clone(bad length 4, expected -1 for: action0(01 00 00 00), ct(commit),0) With the fix: # ovs-dpctl dump-flows , packets:0, bytes:0, used:never, actions:clone(ct(commit),0) Additionally fixed an incorrect attribute name in the comment. Fixes: b233504033db ("openvswitch: kernel datapath clone action") Signed-off-by: Ilya Maximets Acked-by: Aaron Conole Link: https://lore.kernel.org/r/20220404104150.2865736-1-i.maximets@ovn.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/openvswitch/actions.c | 2 +- net/openvswitch/flow_netlink.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 100cc09c100d..8b75afe41284 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -1098,7 +1098,7 @@ static int clone(struct datapath *dp, struct sk_buff *skb, int rem = nla_len(attr); bool dont_clone_flow_key; - /* The first action is always 'OVS_CLONE_ATTR_ARG'. */ + /* The first action is always 'OVS_CLONE_ATTR_EXEC'. */ clone_arg = nla_data(attr); dont_clone_flow_key = nla_get_u32(clone_arg); actions = nla_next(clone_arg, &rem); diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index fb69978f50ec..4413ffdc1e03 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c @@ -3173,7 +3173,9 @@ static int clone_action_to_attr(const struct nlattr *attr, if (!start) return -EMSGSIZE; - err = ovs_nla_put_actions(nla_data(attr), rem, skb); + /* Skipping the OVS_CLONE_ATTR_EXEC that is always the first attribute. */ + attr = nla_next(nla_data(attr), &rem); + err = ovs_nla_put_actions(attr, rem, skb); if (err) nla_nest_cancel(skb, start); -- 2.35.1