From: sashiko-bot@kernel.org
To: "Snehal Sanghvi" <snsanghvi@linux.microsoft.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next] RDMA/mana_ib: support enhanced connection establishment
Date: Fri, 20 Nov 2026 01:20:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-224293@kernel.org> (raw)
In-Reply-To: <20261120010851.616472-1-snsanghvi@linux.microsoft.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:
- [Critical] RDMA/mana_ib: null pointer dereference in
mana_ib_gd_create_rc_qp() [1]
- [High] RDMA/mana_ib: integer overflow in mana_ib_create_rc_qp() [2]
--
commit e575bd297d63089e7e8cc394cb0a9db17a952542
Author: Snehal Sanghvi <snsanghvi@microsoft.com>
RDMA/mana_ib: support enhanced connection establishment
This commit exposes enhanced connection establishment (ECE) capabilities
to user space when supported by firmware, returns firmware ECE offers on
RC and UC QP creation, and uses the RNIC V4 set-state layout during QP
modifications to exchange ECE options with firmware.
> diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c
> index 8181b0cecdef0..75403e6bdfcb6 100644
> --- a/drivers/infiniband/hw/mana/main.c
> +++ b/drivers/infiniband/hw/mana/main.c
[ ... ]
> @@ -1054,7 +1056,8 @@ int mana_ib_gd_destroy_cq(struct mana_ib_dev *mdev, struct mana_ib_cq *cq)
> }
>
> int mana_ib_gd_create_rc_qp(struct mana_ib_dev *mdev, struct mana_ib_qp *qp,
> - struct ib_qp_init_attr *attr, u32 doorbell, u64 flags)
> + struct ib_qp_init_attr *attr, u32 doorbell, u64 flags,
> + u32 *ece_options)
> {
> struct mana_ib_cq *send_cq = container_of(qp->ibqp.send_cq, struct mana_ib_cq, ibcq);
> struct mana_ib_cq *recv_cq = container_of(qp->ibqp.recv_cq, struct mana_ib_cq, ibcq);
[Severity: Critical]
This problem wasn't introduced by this patch, but can qp->ibqp.send_cq
and qp->ibqp.recv_cq be NULL here [1]?
When user space creates an RC, UC, or UD QP via UVERBS_METHOD_QP_CREATE
with an indirection table (rwq_ind_tbl) and max_send_wr = 0, the uverbs
core treats both CQs as optional and leaves qp->ibqp.send_cq and
qp->ibqp.recv_cq NULL. Applying container_of() to them and reading
send_cq->cq_handle and recv_cq->cq_handle in mana_ib_gd_create_rc_qp()
(as well as mana_ib_gd_create_uc_qp(), mana_ib_gd_create_ud_qp(), and
mana_remove_qp_from_cqs()) causes a NULL pointer dereference.
> diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
> index 62980e0762f78..dec4a84f5c150 100644
> --- a/drivers/infiniband/hw/mana/qp.c
> +++ b/drivers/infiniband/hw/mana/qp.c
> @@ -656,7 +656,7 @@ static int mana_ib_create_rc_qp(struct ib_qp *ibqp, struct ib_pd *ibpd,
> qp->rc_qp.wqe_size_in_bu = wqe_size / GDMA_WQE_BU_SIZE;
> }
>
> - err = mana_ib_gd_create_rc_qp(mdev, qp, attr, doorbell, flags);
> + err = mana_ib_gd_create_rc_qp(mdev, qp, attr, doorbell, flags, &resp.ece_options);
[Severity: High]
This problem wasn't introduced by this patch, but can an unvalidated
attr->cap.max_send_sge overflow the 32-bit wqe_size calculation in
mana_ib_fixed_wqe_size() [2]?
drivers/infiniband/hw/mana/qp.c:mana_ib_wqe_size() {
u32 wqe_size = sge * sizeof(struct gdma_sge) + sizeof(struct gdma_wqe) + oob_size;
return ALIGN(wqe_size, GDMA_WQE_BU_SIZE);
}
drivers/infiniband/hw/mana/qp.c:mana_ib_fixed_wqe_size() {
return roundup_pow_of_two(mana_ib_wqe_size(sge, oob_size));
}
When MANA_IB_RC_QP_FIXED_WQE is set, user-controlled
attr->cap.max_send_sge is passed to mana_ib_fixed_wqe_size() without a
bounds check against mdev->adapter_caps.max_send_sge_count. If sge is
0x0ffffffc, ALIGN(wqe_size, GDMA_WQE_BU_SIZE) wraps to 0 and
roundup_pow_of_two(0) performs an out-of-bounds shift (1UL << 64), or if
wqe_size exceeds 0x80000000, roundup_pow_of_two() returns 0x100000000UL
which truncates to 0 in u32 and sets qp->rc_qp.wqe_size_in_bu to 0.
[1] https://sashiko.dev/#/bug/linux-86b919ff-d815-475b-90a6-38b75879f413
[2] https://sashiko.dev/#/bug/linux-c09403d1-5db1-420f-88f0-f4df2a2d57af
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120010851.616472-1-snsanghvi@linux.microsoft.com?part=1
prev parent reply other threads:[~2026-11-20 1:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 1:08 [PATCH rdma-next] RDMA/mana_ib: support enhanced connection establishment Snehal Sanghvi
2026-11-20 1:20 ` sashiko-bot [this message]
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-224293@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=snsanghvi@linux.microsoft.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.