From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2665DA0C47; Tue, 26 Oct 2021 11:06:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E567D410D5; Tue, 26 Oct 2021 11:06:14 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2088.outbound.protection.outlook.com [40.107.212.88]) by mails.dpdk.org (Postfix) with ESMTP id 89BBC407FF for ; Tue, 26 Oct 2021 11:06:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g90lT4Q7BhibFWjddJLkx60RW70NB3Zq0Mt087yO4RpXsiDADGLAwQehH9GQ4ZPDu2NdcUmqkq0gizXp7f9RrV/yf3oucz6ocmoS6eYqD1DWNcovha4OiPRXjgh7U93H+SXHk7HIrO1Q8jKJa2/A6/FmBR/NXMRAXV20oWXQWEo58aO0gjsHPpCKFHBE7wJYh70FpIE0646GLASo+lFNM4l1z05oVHtslQR8DQwnAVyCAoNDBP0kP/PoI5DQoRwvdzaZxzR3f/FuFkTiTRpYi3bKXvNil2yE20eywr+BQdFIVSnbNwAOV/LHwHlFi/IzWF6sHwvEYsM357JU6zsriw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gYAj1wUSFNCUwiJc8V+mOESxRYZlSjXww/HvJqkbYmo=; b=j7WFkM56x4bSKgJ4a5SHAYL9l63CuAY5u0AK8WKoKpHrBPSiRKAanKAwxnhZXK2cgqKohBHjP7ctHou2HFVtgoT3SlGNmznUV2AHQ0T89WOhBhSyJCsIQCkx1fR+3pqiozFsA30HXws2XlBO7015ydCjoodl2KX/lAFYTprTFU/1s1ajnrdB4RjTWjA/G1RFbWGDJzZv9YdMUptV9rA9+qCvFWfhyP56vLTF8QLOYWpe9kTntSAboWa7KFGzvAgr9fC88O7wgILE6C9jH+qLWO9C6kCg3g3NeNavYlPKEd9x3zjrR3MzKC10pF5QR1vcADL6k2ELa4VWwDzvDfFx2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gYAj1wUSFNCUwiJc8V+mOESxRYZlSjXww/HvJqkbYmo=; b=aeryf8SvIZ+qc9QxDPnvJBHczT6DfivVcnmzimVIhOrGsJCsPrqniQg3G8P8XIaEQR0GrBEisTqls47xMKAofgWlnRN6S4+rmpZzq4rduKaBkHl4bUeuY/F5+YOBbjwHKOJGNsvRnqEXqRIEmxs1gvXZ2n7qj13USBb6Oek7vHifDbbIRoEFOHIGO86uvUeI1QbqKG2DOpGrqS/3d/lfTHjfBBZt2Us6Scso8sjSzlldiPBOTsU67RyCEEX28mlJOuz92ft1JV/YajoltYZDqShJhlorHLW5lwO+J/RFncDTxnH/Ma+R2RVbfkNZG8XME/W6wejP/D1hr99ZeSMEwA== Received: from DM6PR17CA0003.namprd17.prod.outlook.com (2603:10b6:5:1b3::16) by CY4PR12MB1526.namprd12.prod.outlook.com (2603:10b6:910:4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Tue, 26 Oct 2021 09:06:10 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b3:cafe::b) by DM6PR17CA0003.outlook.office365.com (2603:10b6:5:1b3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Tue, 26 Oct 2021 09:06:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Tue, 26 Oct 2021 09:06:10 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 26 Oct 2021 09:06:07 +0000 From: Gregory Etelson To: , CC: , , Viacheslav Ovsiienko , Ori Kam , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" Date: Tue, 26 Oct 2021 12:05:54 +0300 Message-ID: <20211026090554.9128-1-getelson@nvidia.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89c442b5-a324-4a0a-f9eb-08d9985fda87 X-MS-TrafficTypeDiagnostic: CY4PR12MB1526: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g6jVLi/mi2TIiSuHfgi9sL3zW2KjNm6HDsvxFjfi37A+3DDSoYEsyiueNt9sCiwmzl2juO4vkOY4ccBP2H51ia4whEVifwEqmxOkiHeOSqanUtU4P94W9cYhmX4AN3s1PTZjpox0A5vSJagcPu2J58NjQ6FLFj5mVSXJTQ5L+XPpcBaonI6ML4i894mRCbfR3s9tLd+zKijMmBH5SJcMwVx7juRqaXIBk/R0wxZ3dqahPyNRwjAoinIrJ0KsMHYGWMGbFMKymK+T3Jd95MVdbR1qzRbhrG2n8WwuFHRa2qNcGwwzdA9jHR7WH1YibaGpGmayY15QsXPA1CXKuaQ21kropNjNrUBzi+7Kc43W+m6Nq2so0AXGVbSW/BiYEJsuvuz4X8YN6fZZyExqa95G71OkazVoxoYHjZLLC4yeBtIKvnscpPQwhZRc1l8Swixg/jvZLlGb2RyZh45VW1w76VaF5mU6y51j6HKqxv0fsr13wO0Y6LBfGU4GuZYxhF7m91ibc0SemN/7GFyQrffIEDjtqZNF28aNt7y+qmNZPxqOaWXR2Xazx6+H42FD6VntcioBA20LfS3gIy69dLFLDpVfxi9IVYAn6iNFLAWpdZkz/TijMunUIQB2zxB8VJPkZ2dYRkAcG8dYXCpbVBK61UIJUzwCjRoAFWqGhxw9nEzObfOcrGGJoG00WOQO04erAa5oTn/VgVg1LsME4qEixw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(356005)(47076005)(36906005)(8936002)(4326008)(508600001)(16526019)(36860700001)(7636003)(110136005)(2906002)(8676002)(86362001)(36756003)(336012)(316002)(5660300002)(6666004)(1076003)(55016002)(70206006)(70586007)(426003)(54906003)(82310400003)(6286002)(7049001)(83380400001)(2616005)(7696005)(26005)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2021 09:06:10.4056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89c442b5-a324-4a0a-f9eb-08d9985fda87 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1526 Subject: [dpdk-dev] [PATCH] ethdev: fix variable length flow elements support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" RTE flow API defines two flow items and actions types - common and PMD private. Common RTE flow types are defined in rte_flow.h while PMD private types restricted to specific PMD only. RTE flow API allows PMD private types in flow rule, but it must not try to interpret private item or acton properties. Current implementation tried to locate PMD private element, item or action, in common flow elements records. The patch restricts access to common flow elements records for non-private PMD types only. Fixes: 6cf72047332b ("ethdev: support flow elements with variable length") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- lib/ethdev/rte_flow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index d268784532..a93f68abbc 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -54,11 +54,13 @@ rte_flow_conv_copy(void *buf, const void *data, const size_t size, /** * Allow PMD private flow item */ - size_t sz = type >= 0 ? desc[type].size : sizeof(void *); + bool rte_type = type >= 0; + + size_t sz = rte_type ? desc[type].size : sizeof(void *); if (buf == NULL || data == NULL) return 0; rte_memcpy(buf, data, (size > sz ? sz : size)); - if (desc[type].desc_fn) + if (rte_type && desc[type].desc_fn) sz += desc[type].desc_fn(size > 0 ? buf : NULL, data); return sz; } -- 2.33.1