* [PATCH v4] RDMA/srpt: Reject an srp_sq_size that does not fit in a CQ
@ 2026-09-25 21:36 Serhat Kumral
0 siblings, 0 replies; only message in thread
From: Serhat Kumral @ 2026-09-25 21:36 UTC (permalink / raw)
To: Bart Van Assche, Jason Gunthorpe, Leon Romanovsky
Cc: linux-rdma, Sagi Grimberg, target-devel, linux-kernel, Serhat Kumral
srpt_create_ch_ib() asks ib_cq_pool_get() for rq_size + srp_sq_size
CQ entries, but srp_sq_size is only checked against MAX_SRPT_SRQ_SIZE
(65535), never against the device's max_cqe. On a device with a
smaller limit, such as rxe (32767), ib_cq_pool_get() keeps allocating
CQs that can never satisfy the request until memory runs out:
Out of memory and no killable processes...
Kernel panic - not syncing: System is deadlocked on memory
Workqueue: ib_cm cm_work_handler
Call Trace:
__vmalloc_node_range_noprof
vmalloc_user_noprof
rxe_queue_init
rxe_cq_from_init
rxe_create_cq
__ib_alloc_cq
ib_cq_pool_get
srpt_cm_req_recv.cold
Reject such values when srp_sq_size is written.
Fixes: c804af2c1d31 ("IB/srpt: use new shared CQ mechanism")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 7197d95f2216..1761345b33f1 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3603,6 +3603,8 @@ static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item,
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = srpt_tpg_to_sport(se_tpg);
+ const struct ib_device_attr *attrs = &sport->sdev->device->attrs;
+ u32 rq_size = min(attrs->max_qp_wr, MAX_SRPT_RQ_SIZE);
unsigned long val;
int ret;
@@ -3621,6 +3623,11 @@ static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item,
MIN_SRPT_SRQ_SIZE);
return -EINVAL;
}
+ if (val + rq_size > attrs->max_cqe) {
+ pr_err("val: %lu exceeds max_cqe: %u minus rq_size: %u\n",
+ val, attrs->max_cqe, rq_size);
+ return -EINVAL;
+ }
sport->port_attrib.srp_sq_size = val;
return count;
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-25 21:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 21:36 [PATCH v4] RDMA/srpt: Reject an srp_sq_size that does not fit in a CQ Serhat Kumral
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®