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 C220346AD2 for ; Wed, 2 Jul 2025 14:36:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C581402A0; Wed, 2 Jul 2025 14:36:28 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id B3D5E402A0 for ; Wed, 2 Jul 2025 14:36:26 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-748f5a4a423so2716805b3a.1 for ; Wed, 02 Jul 2025 05:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uetpeshawar-edu-pk.20230601.gappssmtp.com; s=20230601; t=1751459786; x=1752064586; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=alDVY7o1kp+HQc+3EQnP9c4GU7L8oQqtkfXGNsj7IpA=; b=FrBH6nUU37rVrAbHi3eQPUFMvKnClLdaDiCraxRGcQa4UXzkDtrazmoE1OXV78WpeH ACd9S4a1Fh5PWsLcB3lp7PiC0dBzHmXj+9zIwMvj08r4syGmOjDdsBppnPzcllGIdvrr IhqkXSEQzie/z/gih1W4ERXaKGBBdVHoj3q8NzYSClMxEdNxOMPogDA7UC2X/hDqwh4y gE9Ht/NxpKrHOoSx9jFrLAoEP14Ma28WhzWUUhGisiL+661ADCGiHFC+3AFEj+8VRawY IHY3X03zfEcm22OwV1HHlOO8QmxBeL+yv03fLzYc7gwst9iQHr12mshpn0PfJCPTM2pG fy6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751459786; x=1752064586; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=alDVY7o1kp+HQc+3EQnP9c4GU7L8oQqtkfXGNsj7IpA=; b=TAo556vNv9u6o1WeNWKtdkRMPxAe1x19Okc/Ab29YWWeGHmjiwalyhy+uCub66OmnA JPXiJtP0uPDvQRJRa/pdc/Vuf1BnF+xJXp9Ss81dyqD/CXuXKcCfQE5LBd5B23wtHw0n tOKMir4YNi3tvUqqXZzswlhhyoTIgBSQjoBVFAyn77OPYhDbkDl9SzbAwyDwLoPfccw0 2f98DkroTzbKm1nyfDZPNyCplft1CryS8ac1Mw+zLYLv6AEirSAUjifbJ9p/SPjKmfaR /VklDDGxKdAozM7y1SdG9wWFXetSRQXEMYoBiNl0YEgB+IgdL8qMwuN0DwMJa/ZmTBn+ pIzw== X-Forwarded-Encrypted: i=1; AJvYcCXe0eIKKsii1/4W6t5CUEjSR0vw3roMTYq+5TVU9oJYdK+Vq0tKk5ulSQaV4cgBFVerx61UtAU=@dpdk.org X-Gm-Message-State: AOJu0YxJn569swrS4XvQX17IL3vfLZ8yxUWJ58ZzVEBq9zGHz/h8D9yL y77ewQDMww/v5UBqt34vWl8pJWFu4de06QLSQFB0jSXrndUH+ZkUv93ZUXhkaU++qhM= X-Gm-Gg: ASbGnctWsr7u3JzA9stbaM05zH2SxCz6elo7GasepEOCwj4bMmh0w+Djzy6k9gDkbJw wEOFEfZXlU61ZscpmOXY9Gv9b967vG28ZkRbHKcQ25mQdQOPhAt5SaL8qjlCSMiXXu1aw8ZXhyj D7WK0wEWjSJLUCrfnsBRznx5nANwmriJA0c7G1PldrEkaMNrAWzE6U17uRLcurK0zaUz8BVU6EF odxY/D6MKytSdHkSZPVDVeRD7rgfXhSKoaW2pzkteurvfrtltMb4I3P/ly4BI/ZgNL/5/gmKhSW vcvSra1Okp+DIIuwJCogCBuqm4/XyCAwDKI78qq3E2r6fuslNCj/mxLvhffdoe//BSCe6GSxaH8 Dyx9FS6fEHbF1 X-Google-Smtp-Source: AGHT+IEx+9TwpcfQl4nFeDWRSxZX3PM2vwhzFn3jF6n3UiGg0Ul9D84Ma5+aMvhZCSFtTo0TToN4ww== X-Received: by 2002:a05:6a20:430b:b0:216:1ea0:a526 with SMTP id adf61e73a8af0-222d7f32a61mr6100460637.40.1751459785588; Wed, 02 Jul 2025 05:36:25 -0700 (PDT) Received: from localhost.localdomain ([64.62.143.197]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74af557b3a2sm13980041b3a.104.2025.07.02.05.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 05:36:25 -0700 (PDT) From: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> To: dev@dpdk.org Cc: rasland@nvidia.com, stable@dpdk.org, Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> Subject: [PATCH] net/mlx5: fix crash when using meter in transfer flow Date: Wed, 2 Jul 2025 08:36:17 -0400 Message-ID: <20250702123617.1814996-1-14pwcse1224@uetpeshawar.edu.pk> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org When creating a flow rule with the transfer attribute and a meter action, the driver did not validate this combination and would crash due to unsupported handling. This patch adds explicit validation rejecting meter action in transfer flows with an appropriate error message. Fixes: 46a5e6bc6a85 ("net/mlx5: prepare meter flow tables") Cc: stable@dpdk.org Steps to reproduce: 1. Launch testpmd: ./build/app/dpdk-testpmd -l 0,1 -a -- -i --rxq=8 --txq=8 2. Inside testpmd: add port meter profile trtcm_rfc2698 0 0 5 10 50 100 1 add port meter policy 0 0 g_actions mark id 3 / queue index 2 / end / y_actions mark id 7 / queue index 3 / end r_actions drop / end create port meter 0 0 0 0 yes 0xffff 0 y 0 3. flow create 0 group 0 ingress pattern eth / ipv4 / end actions jump group 1 / end 3. Following causes a segmentation fault: flow create 0 transfer ingress pattern eth / ipv4 / end actions meter mtr_id 0 / end This patch ensures proper handling of the meter action with transfer rule to prevent this crash. Signed-off-by: Khadem Ullah <14pwcse1224@uetpeshawar.edu.pk> --- drivers/net/mlx5/mlx5_flow.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 8db372123c..a7b793ef29 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -7993,7 +7993,17 @@ mlx5_flow_create(struct rte_eth_dev *dev, struct rte_flow_attr *new_attr = (void *)(uintptr_t)attr; uint32_t prio = attr->priority; uintptr_t flow_idx; - + if (attr && attr->transfer) { + const struct rte_flow_action *act; + for (act = actions; act && act->type != RTE_FLOW_ACTION_TYPE_END; ++act) { + if (act->type == RTE_FLOW_ACTION_TYPE_METER) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, act, + "Meter action is not supported in transfer flows"); + return NULL; + } + } + } /* * If the device is not started yet, it is not allowed to created a * flow from application. PMD default flows and traffic control flows -- 2.43.0