All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernard Metzler <bernard.metzler@linux.dev>
To: Serhat Kumral <serhatkumral1@gmail.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg()
Date: Mon, 28 Sep 2026 11:50:45 +0200	[thread overview]
Message-ID: <05e55fe5-04b0-4fab-a256-eafcdf14cc81@linux.dev> (raw)
In-Reply-To: <20260927115351.12245-1-serhatkumral1@gmail.com>

On 27.09.2026 13:53, Serhat Kumral wrote:
> When a short-single SGE payload crosses a page boundary, siw_try_1seg()
> computes the length of the first chunk as the amount that spills into
> the second page instead of the amount left in the first page
> 
> 	part = bytes - (PAGE_SIZE - off);
> 
> Use the remaining length of the first page as the first chunk.
> 
> Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
> Assisted-by: LLM
> Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
> ---
>   drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
> index f7dd32c6e5ba..54c9d97015e8 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_tx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
> @@ -85,7 +85,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
>   			if (likely(PAGE_SIZE - off >= bytes)) {
>   				memcpy(paddr, buffer + off, bytes);
>   			} else {
> -				unsigned long part = bytes - (PAGE_SIZE - off);
> +				unsigned long part = PAGE_SIZE - off;
>   
>   				memcpy(paddr, buffer + off, part);
>   				kunmap_local(buffer);

Excellent finding. Thanks very much Serhat.

This is quite serious, since we may copy data
from a location beyond the current page (if there
are more remaining bytes to be copied in the next
page than in the current page).

Acked-by: Bernard Metzler <bernard.metzler@linux.dev>

  parent reply	other threads:[~2026-09-28  9:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 11:53 [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg() Serhat Kumral
2026-09-27 12:05 ` sashiko-bot
2026-09-28  9:50 ` Bernard Metzler [this message]
2026-09-29 22:59 ` Jason Gunthorpe

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=05e55fe5-04b0-4fab-a256-eafcdf14cc81@linux.dev \
    --to=bernard.metzler@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=serhatkumral1@gmail.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.