Skip to contentSkip to conversation

net/mlx5: fix RSS expansion inner buffer overflow.

PATCH In review Maayan Kashani 2 participants 2 messages Jul 6, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net/mlx5: fix RSS expansion inner buffer overflow.

The stack which used for RSS expansion was overflowed and trashed RSS expansion data. (buf->entry[MLX5_RSS_EXP_ELT_N]).
Due to this overflow, packets such as ARP or LACP with overwritten RSS types due to the overflow will be dropped.

This increases the buffer size to avoid such overflows and adds relevant ASSERT for the future.

Bugzilla ID: 1173

---
 drivers/net/mlx5/mlx5_flow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.c +2 -1
index cf83db7b60..41e298855b 100644
@@ -374,7 +374,7 @@ mlx5_flow_expand_rss_skip_explicit(const struct mlx5_flow_expand_node graph[],
 	return next;
 }
 
-#define MLX5_RSS_EXP_ELT_N 16
+#define MLX5_RSS_EXP_ELT_N 32
 
 /**
  * Expand RSS flows into several possible flows according to the RSS hash
@@ -539,6 +539,7 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 			if (lsize > size)
 				return -EINVAL;
 			n = elt * sizeof(*item);
+			MLX5_ASSERT((buf->entries) < MLX5_RSS_EXP_ELT_N);
 			buf->entry[buf->entries].priority =
 				stack_pos + 1 + missed;
 			buf->entry[buf->entries].pattern = addr;
Signature · 1 line
2.25.1
Reviewed-by on v3 1/1
#1 lore raw

Hi,

Quoted 10 lines

-----Original Message-----
From: Maayan Kashani <[email protected]>
Sent: Thursday, July 6, 2023 11:56 AM
To: [email protected]
Cc: Maayan Kashani <[email protected]>; Ori Kam <[email protected]>; Raslan Darawsheh <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v3] net/mlx5: fix RSS expansion inner buffer overflow.

Quoted 2 lines

The stack which used for RSS expansion was overflowed and trashed RSS expansion data.

[Raslan Darawsheh] line too long, wrap at 75 char will fix during integration

Quoted 10 lines

(buf->entry[MLX5_RSS_EXP_ELT_N]).
Due to this overflow, packets such as ARP or LACP with overwritten RSS types due to the
overflow will be dropped.

This increases the buffer size to avoid such overflows and adds relevant ASSERT for the future.

Bugzilla ID: 1173

missing fixes tag and CC stable:

Fixes 18ca4a4ec73a ("net/mlx5: support ESP SPI match and RSS hash")

will fix during integration

missing:

will fix during the integration

Quoted 3 lines

---

Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh