From: sashiko-bot@kernel.org
To: "Edward Srouji" <edwards@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next 01/11] RDMA/mlx5: Enforce dev/mdev naming for device pointers
Date: Wed, 18 Nov 2026 14:04:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-221130@kernel.org> (raw)
In-Reply-To: <20261117-mlx5-sd-prep-v1-1-8efd124c7895@nvidia.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 2 related pre-existing issues it does not
introduce:
- [Medium] RDMA/mlx5: out-of-bounds read in devx_get_obj_id() on short
commands [1]
- [High] RDMA/mlx5: deadlock in mlx5_poll_one() [2]
--
commit 3bdcdff9fe049e25d51894257ec6c6716c3a9770
Author: Akiva Goldberger <agoldberger@nvidia.com>
RDMA/mlx5: Enforce dev/mdev naming for device pointers
This commit renames variables, parameters, and struct fields across mlx5_ib so
that dev exclusively refers to struct mlx5_ib_dev pointers and mdev
exclusively refers to struct mlx5_core_dev pointers.
> diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
> index fc6f793dcc658..7e84dd15ac1f9 100644
> --- a/drivers/infiniband/hw/mlx5/devx.c
> +++ b/drivers/infiniband/hw/mlx5/devx.c
[ ... ]
> @@ -1652,7 +1652,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_MODIFY)(
> MLX5_IB_ATTR_DEVX_OBJ_MODIFY_HANDLE);
> struct mlx5_ib_ucontext *c = rdma_udata_to_drv_context(
> &attrs->driver_udata, struct mlx5_ib_ucontext, ibucontext);
> - struct mlx5_ib_dev *mdev = to_mdev(c->ibucontext.device);
> + struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
> void *cmd_out;
> int err, err2;
> int uid;
> @@ -1677,7 +1677,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_MODIFY)(
> MLX5_SET(general_obj_in_cmd_hdr, cmd_in, uid, uid);
> devx_set_umem_valid(cmd_in);
>
> - err = mlx5_cmd_do(mdev->mdev, cmd_in,
> + err = mlx5_cmd_do(dev->mdev, cmd_in,
> uverbs_attr_get_len(attrs, MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_IN),
> cmd_out, cmd_out_len);
[Severity: Medium]
This problem wasn't introduced by this patch, but can devx_get_obj_id() read
past the end of cmd_in [1] when called from
MLX5_IB_METHOD_DEVX_OBJ_MODIFY, MLX5_IB_METHOD_DEVX_OBJ_QUERY, or
MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY?
The uverbs attribute spec only enforces a 16-byte minimum
(general_obj_in_cmd_hdr) on cmd_in, and these handlers call
devx_is_valid_obj_id() -> devx_get_obj_id() without checking that the buffer
is large enough for the opcode-specific object ID field. For an opcode such
as MLX5_CMD_OP_MODIFY_FLOW_TABLE, reading table_id in modify_flow_table_in at
byte offset 20 performs a 4-byte out-of-bounds read when userspace supplies a
16-byte cmd_in.
[ ... ]
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 65455aedd559b..1ecd79929f8cf 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
[ ... ]
> @@ -4483,7 +4483,7 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
> atomic_set(&dev->mkey_var, 0);
>
> spin_lock_init(&dev->dm.lock);
> - dev->dm.dev = mdev;
> + dev->dm.mdev = mdev;
[Severity: High]
This problem wasn't introduced by this patch, but can dev->sig_mrs deadlock
in mlx5_poll_one() [2] because mlx5_ib_stage_init_init() initializes
it with xa_init() instead of xa_init_flags(..., XA_FLAGS_LOCK_IRQ)?
Process-context callers such as mlx5_alloc_integrity_descs() and
__mlx5_ib_dereg_mr() take xa_lock on dev->sig_mrs via xa_store() or
xa_erase() with local interrupts enabled, while mlx5_poll_one() takes the
same xa_lock from CQ interrupt context on a MLX5_CQE_SIG_ERR completion:
mlx5_alloc_integrity_descs()
xa_store(&dev->sig_mrs, ...)
spin_lock(&xa->xa_lock)
<hardirq>
...
mlx5_poll_one()
xa_lock(&dev->sig_mrs) <-- spins forever
[1] https://sashiko.dev/#/bug/linux-2b4a0b34-fea8-4d2a-87be-350c461b8f4f
[2] https://sashiko.dev/#/bug/linux-4a13b647-d8f7-45a3-8a1e-c17db57fefbb
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-mlx5-sd-prep-v1-0-8efd124c7895@nvidia.com?part=1
next prev parent reply other threads:[~2026-11-18 14:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:01 [PATCH rdma-next 00/11] RDMA/mlx5: Preparation for SD support Edward Srouji
2026-11-17 14:01 ` [PATCH rdma-next 01/11] RDMA/mlx5: Enforce dev/mdev naming for device pointers Edward Srouji
2026-11-18 14:04 ` sashiko-bot [this message]
2026-11-17 14:01 ` [PATCH rdma-next 02/11] RDMA/mlx5: Rename to_mdev() helpers that return an IB device Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 03/11] RDMA/mlx5: Select the PD and SRQ core device through the PD Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 04/11] RDMA/mlx5: Select the core device through PD for QP commands Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 05/11] RDMA/mlx5: Cache the MR core device and resolve the MW's via its PD Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 06/11] RDMA/mlx5: Select the AH core device through their PD Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 07/11] RDMA/mlx5: Select the QP core device through its PD Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 08/11] RDMA/mlx5: Resolve core device from ucontext for DEVX resources Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 09/11] RDMA/mlx5: Cache the CQ core device and resolve it via cq_to_mdev() Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 10/11] RDMA/mlx5: Resolve the bfreg UAR-index core device from the ucontext Edward Srouji
2026-11-18 14:04 ` sashiko-bot
2026-11-17 14:01 ` [PATCH rdma-next 11/11] RDMA/mlx5: Resolve UAR and mmap core devices via " Edward Srouji
2026-11-18 14:04 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-221130@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=edwards@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox