Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp6472lfv; Tue, 12 Apr 2022 15:02:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeUtDSslRS/HKoTWPDF4ZwMq7UBg0SG74cGi7iAdyYvzw02BS9LvFClEto8e+VGaeQHIQD X-Received: by 2002:a05:6870:1793:b0:de:a69a:118d with SMTP id r19-20020a056870179300b000dea69a118dmr3178784oae.163.1649800928956; Tue, 12 Apr 2022 15:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649800928; cv=none; d=google.com; s=arc-20160816; b=Eu1lToGpADl3bedR3lMWG1L1mb0OcJGGa3lZavusWvanh/PoqsDx9rhPxesseUumFx I/6NNAnHQNC70vzC9sNX3Y+hE/Q31osYr5cLlPRn4dMAN58gHWEh8lNGGHhUqbTB/rai TFNVu1OvJ6kIGsWWzVqUKYaoT0OACsufuLe68NK0GVRUxblv4H76aNQj4FHf1Svsq1Ph MjIwaFVwHBDkAIQl8qysP6bUM/eYADLyRFNX7pS2OeVtxd0XFo2KeeTiEwHLEcw3WzfV Gie9R/HY6flS3h+Hh8K4wl9wQL9FhCvfN6YsXcqPVWbsq0n9cKiq4806q/+4ie07SyuA HQzA== 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=+CEjA4REs0w3+oSeDHi3121CYpOXdfcR5PDFTmaDYiU=; b=NcfRlSSRUrKDdK4pzqJhQsce/Sxq1e04BecUR7jcqxVOO6VEjN8bYFRkVDyc7nvciH UzUntBqtERts1f6HTiX65VEIvp03aNLIppLnM6i4mA5OcUizTAtr4Y4tu1DQYNbM59Xi ThneQkmwNwA7eQ0kB9c0XznKiHupVg2SMWSVTH2A4Hto59zlUuBbDloDPG4UT9fxDI7R HGVTrc9iORmq21Kr+Lgl32aHWWdN+DtUsl7FLer4JZKRrAm+xPlCxnsqnm+yhlVdGNSp 7X7YNm2yq6NQLmoeKNghEYkl1j8VYNsVO0V2cLcEfEoN1mSZ6DA7M0DLogT4Ms1qS0nh hBMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gjW87X29; 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 k22-20020a056870959600b000ddbcddcaf9si9102318oao.40.2022.04.12.15.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:02:08 -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=gjW87X29; 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 1EDCD15472D; Tue, 12 Apr 2022 13:54:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346964AbiDLIC3 (ORCPT + 99 others); Tue, 12 Apr 2022 04:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353637AbiDLHZv (ORCPT ); Tue, 12 Apr 2022 03:25:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA9043AFF; Tue, 12 Apr 2022 00:02: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2C18F60B2B; Tue, 12 Apr 2022 07:02:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F64AC385A6; Tue, 12 Apr 2022 07:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649746959; bh=vr7Wo20zHLHWbtiSd/Y1L2t36ZxOiBHBQ+ROACpAYAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjW87X29xvCqlhXmL8z4SKyVVI0G6SdbTYF6tOrzboi6TyEU0ezh9WaGKX7FqKfvz tsQPdntymVShhDTROanvHWdr1i1hhJXa+2E/gTjL6XAjpu9l0PusPBe7RW7mjXEn6K IfUsDd0JJiQjn/lCgfzYrmcps4Xk12548Xw3t/F8= 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 5.16 191/285] net: openvswitch: dont send internal clone attribute to the userspace. Date: Tue, 12 Apr 2022 08:30:48 +0200 Message-Id: <20220412062949.174513537@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062943.670770901@linuxfoundation.org> References: <20220412062943.670770901@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 780d9e2246f3..8955f31fa47e 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -1051,7 +1051,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 0d677c9c2c80..2679007f8aeb 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c @@ -3429,7 +3429,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