* [PATCH] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler
@ 2026-10-18 14:49 Serhat Kumral
2026-10-20 8:16 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Serhat Kumral @ 2026-10-18 14:49 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe
Cc: Mark Bloch, Saeed Mahameed, Yishai Hadas, linux-rdma,
linux-kernel, Serhat Kumral
In MLX5_IB_METHOD_STEERING_ANCHOR_CREATE, the user-supplied u16 priority
is passed directly to _get_flow_table() without an upper bound check.
This can lead to out-of-bounds array accesses on dev->flow_db priority
tables.
Check that priority does not exceed MLX5_IB_FLOW_LAST_PRIO before calling
_get_flow_table(), matching the existing validation in raw_fs_rule_add()
and mlx5_ib_create_flow().
Fixes: 0c6ab0ca9a66 ("RDMA/mlx5: Expose steering anchor to userspace")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
found by smatch:
- drivers/infiniband/hw/mlx5/fs.c:2013 _get_flow_table() error: buffer overflow 'dev->flow_db->fdb' 16 <= u16max user_rl='0-u16max'
drivers/infiniband/hw/mlx5/fs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
index e63fdb4bc3e3..bc2c15c7172b 100644
--- a/drivers/infiniband/hw/mlx5/fs.c
+++ b/drivers/infiniband/hw/mlx5/fs.c
@@ -3014,6 +3014,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)(
if (err)
return err;
+ if (priority > MLX5_IB_FLOW_LAST_PRIO)
+ return -EINVAL;
+
obj = kzalloc_obj(*obj);
if (!obj)
return -ENOMEM;
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler
2026-10-18 14:49 [PATCH] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Serhat Kumral
@ 2026-10-20 8:16 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-10-20 8:16 UTC (permalink / raw)
To: Jason Gunthorpe, Serhat Kumral
Cc: Mark Bloch, Saeed Mahameed, Yishai Hadas, linux-rdma, linux-kernel
On Sun, 18 Oct 2026 17:49:07 +0300, Serhat Kumral wrote:
> In MLX5_IB_METHOD_STEERING_ANCHOR_CREATE, the user-supplied u16 priority
> is passed directly to _get_flow_table() without an upper bound check.
> This can lead to out-of-bounds array accesses on dev->flow_db priority
> tables.
>
> Check that priority does not exceed MLX5_IB_FLOW_LAST_PRIO before calling
> _get_flow_table(), matching the existing validation in raw_fs_rule_add()
> and mlx5_ib_create_flow().
>
> [...]
Applied, thanks!
[1/1] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler
https://git.kernel.org/rdma/rdma/c/bb75e5580b15cd
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-20 8:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 14:49 [PATCH] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Serhat Kumral
2026-10-20 8:16 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®