The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "yanjun.zhu" <yanjun.zhu@linux.dev>
To: Peiyang He <peiyang_he@smail.nju.edu.cn>,
	jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org,
	Zhu Yanjun <yanjun.zhu@linux.dev>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	pandit.parav@gmail.com, dledford@redhat.com
Subject: Re: [PATCH] RDMA/rxe: Fix OOB in free_rd_atomic_resources()
Date: Wed, 29 Jul 2026 16:46:02 -0700	[thread overview]
Message-ID: <86153a83-a234-4afb-82da-6ac7e4cc2ef9@linux.dev> (raw)
In-Reply-To: <33A3A239F88659D0+20260729073644.2834066-1-peiyang_he@smail.nju.edu.cn>

On 7/29/26 12:36 AM, Peiyang He wrote:
> free_rd_atomic_resources() iterates using qp->attr.max_dest_rd_atomic.
> Updating max_dest_rd_atomic before freeing the old array can make the
> free path walk past the old allocation and trigger a slab out-of-bounds
> write.
> 
> Fix the OOB by moving the assignment after free_rd_atomic_resources()
> so the old array is freed using the old bound. This matches the original
> ordering in commit 8700e3e7c485 ("Soft RoCE driver").
> 
> Fixes: b6bbee0d2438 ("IB/rxe: Properly honor max IRD value for rd/atomic.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>

Thanks a lot. I am fine with this commit. If you can post the mentioned 
OOB in the commit log, it is better.

But without the OOB, this commit still seems OK.

Wait for the feedback from Leon and Jason.

Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>

Zhu Yanjun

> ---
>   drivers/infiniband/sw/rxe/rxe_qp.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
> index f3dff1aea96a..1fffe3c6685d 100644
> --- a/drivers/infiniband/sw/rxe/rxe_qp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
> @@ -707,10 +707,10 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
>   		int max_dest_rd_atomic = attr->max_dest_rd_atomic ?
>   			roundup_pow_of_two(attr->max_dest_rd_atomic) : 0;
>   
> -		qp->attr.max_dest_rd_atomic = max_dest_rd_atomic;
> -
>   		free_rd_atomic_resources(qp);
>   
> +		qp->attr.max_dest_rd_atomic = max_dest_rd_atomic;
> +
>   		err = alloc_rd_atomic_resources(qp, max_dest_rd_atomic);
>   		if (err)
>   			return err;


      reply	other threads:[~2026-07-29 23:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  7:36 [PATCH] RDMA/rxe: Fix OOB in free_rd_atomic_resources() Peiyang He
2026-07-29 23:46 ` yanjun.zhu [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=86153a83-a234-4afb-82da-6ac7e4cc2ef9@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=pandit.parav@gmail.com \
    --cc=peiyang_he@smail.nju.edu.cn \
    --cc=stable@vger.kernel.org \
    /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