From: Bart Van Assche <bvanassche@acm.org>
To: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Cc: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 1/2] RDMA/srp: refuse a target that cannot receive an SRP_RSP
Date: Sun, 25 Oct 2026 07:18:15 -0700 [thread overview]
Message-ID: <1197df7c-f083-4b25-abfa-41cb4954a2cb@acm.org> (raw)
In-Reply-To: <20261025114155.4007867-2-yhlee@isslab.korea.ac.kr>
On 10/25/26 4:41 AM, Yehyeong Lee wrote:
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 5811f02df9805..a85d28b95306a 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -2379,6 +2379,13 @@ static void srp_cm_rep_handler(struct ib_cm_id *cm_id,
>
> if (lrsp->opcode == SRP_LOGIN_RSP) {
> ch->max_ti_iu_len = be32_to_cpu(lrsp->max_ti_iu_len);
> + if (ch->max_ti_iu_len < sizeof(struct srp_rsp)) {
> + shost_printk(KERN_ERR, target->scsi_host, PFX
> + "Target reported max_ti_iu_len %u, too small for a %zu byte SRP_RSP\n",
> + ch->max_ti_iu_len, sizeof(struct srp_rsp));
> + ret = -ECONNRESET;
> + goto error;
> + }
> ch->req_lim = be32_to_cpu(lrsp->req_lim_delta);
> ch->use_imm_data = srp_use_imm_data &&
> (lrsp->rsp_flags & SRP_LOGIN_RSP_IMMED_SUPP);
Is this change perhaps incomplete? When reconnecting.
srp_cm_rep_handler() only allocates the receive buffers when ch->rx_ring
== NULL. srp_rport_reconnect() calls srp_create_ch_ib() and the latter
function keeps rx_ring, but ch->max_ti_iu_len is overwritten from each
new SRP_LOGIN_RSP. If a target reports a larger value on reconnect,
srp_recv_done() calls ib_dma_sync_single_for_{cpu,device}(dev, iu->dma,
ch->max_ti_iu_len, ...) past the mapped length. That breaks the DMA API
rules. The HCA itself can't overrun, because srp_post_recv() uses
iu-> size. Since the series is about bounding the receive IU size,
please make one of these additional changes:
* use iu->size in the two sync calls in srp_recv_done(), or
* on reconnect, refuse (or reallocate for) a max_ti_iu_len larger than
the existing rx_ring[0]->size.
Thanks,
Bart.
next prev parent reply other threads:[~2026-10-25 14:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 11:41 [PATCH 0/2] RDMA/srp: bound the receive IU the target asks for Yehyeong Lee
2026-10-25 11:41 ` [PATCH 1/2] RDMA/srp: refuse a target that cannot receive an SRP_RSP Yehyeong Lee
2026-10-25 14:18 ` Bart Van Assche [this message]
2026-10-25 11:41 ` [PATCH 2/2] RDMA/srp: drop a truncated SRP_RSP Yehyeong Lee
2026-10-25 14:20 ` Bart Van Assche
2026-10-26 5:20 ` [PATCH v2 0/2] RDMA/srp: bound the receive IU the target asks for Yehyeong Lee
2026-10-26 5:20 ` [PATCH v2 1/2] RDMA/srp: refuse a target that cannot receive an SRP_RSP Yehyeong Lee
2026-10-26 5:20 ` [PATCH v2 2/2] RDMA/srp: do not DMA-sync a receive IU past its mapped length Yehyeong Lee
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=1197df7c-f083-4b25-abfa-41cb4954a2cb@acm.org \
--to=bvanassche@acm.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yhlee@isslab.korea.ac.kr \
/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
all inboxes | Powered by JetHome®