DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: prevent querying aged flows on uninit port
@ 2024-02-21  3:23 Bing Zhao
  2024-02-27 16:17 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2024-02-21  3:23 UTC (permalink / raw)
  To: suanmingm, rasland, dev
  Cc: matan, viacheslavo, orika, dsosnowski, stable, michaelba

In HWS template API, the aging mechanism doesn't support shared host
mode now. When the guest's counter is set to 0, the aging won't be
initialized.

The current implementation didn't prevent the user from querying the
aged flows on the uninitialized port. The access of invalid pointers
would cause a crash.

With this commit, the flag of the per port aging initialization will
be checked. This would help to get rid of the invalid accessing.

Fixes: 04a4de756e14 ("net/mlx5: support flow age action with HWS")
Cc: michaelba@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 3bb3a9a178..0e6d6e02dd 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -10937,6 +10937,10 @@ flow_hw_get_q_aged_flows(struct rte_eth_dev *dev, uint32_t queue_id,
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL, "empty context");
+	if (!priv->hws_age_req)
+		return rte_flow_error_set(error, ENOENT,
+					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+					  NULL, "No aging initialized");
 	if (priv->hws_strict_queue) {
 		if (queue_id >= age_info->hw_q_age->nb_rings)
 			return rte_flow_error_set(error, EINVAL,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] net/mlx5: prevent querying aged flows on uninit port
  2024-02-21  3:23 [PATCH] net/mlx5: prevent querying aged flows on uninit port Bing Zhao
@ 2024-02-27 16:17 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2024-02-27 16:17 UTC (permalink / raw)
  To: Bing Zhao, Suanming Mou, dev
  Cc: Matan Azrad, Slava Ovsiienko, Ori Kam, Dariusz Sosnowski, stable,
	Michael Baum

Hi,

> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Wednesday, February 21, 2024 5:23 AM
> To: Suanming Mou <suanmingm@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; Dariusz Sosnowski
> <dsosnowski@nvidia.com>; stable@dpdk.org; Michael Baum
> <michaelba@nvidia.com>
> Subject: [PATCH] net/mlx5: prevent querying aged flows on uninit port
> 
> In HWS template API, the aging mechanism doesn't support shared host mode
> now. When the guest's counter is set to 0, the aging won't be initialized.
> 
> The current implementation didn't prevent the user from querying the aged
> flows on the uninitialized port. The access of invalid pointers would cause a
> crash.
> 
> With this commit, the flag of the per port aging initialization will be checked.
> This would help to get rid of the invalid accessing.
> 
> Fixes: 04a4de756e14 ("net/mlx5: support flow age action with HWS")
> Cc: michaelba@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Suanming Mou <suanmingm@nvidia.com>
> ---[Raslan Darawsheh] 

Patch applied to next-net-mlx

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-27 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21  3:23 [PATCH] net/mlx5: prevent querying aged flows on uninit port Bing Zhao
2024-02-27 16:17 ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).