From: "yanjun.zhu" <yanjun.zhu@linux.dev>
To: WenTao Liang <vulab@iscas.ac.cn>, Jason Gunthorpe <jgg@ziepe.ca>,
Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, Zhu Yanjun <yanjun.zhu@linux.dev>
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix: infiniband/rxe: check_rkey: fix refcount underflow due to unchecked rxe_get return value
Date: Fri, 26 Jun 2026 18:42:40 -0700 [thread overview]
Message-ID: <c219948e-1fd3-4bcf-8e38-0db3bfa49a6d@linux.dev> (raw)
In-Reply-To: <20260626150511.50084-1-vulab@iscas.ac.cn>
On 6/26/26 8:05 AM, WenTao Liang wrote:
> rxe_get is a conditional get (kref_get_unless_zero) that returns 0 when
> the object's refcount is already zero. In check_rkey, the return value of
> rxe_get(mr) is ignored. If rxe_get fails (returns 0), the code continues
> to use mr without a valid reference, and error paths will call
> rxe_put(mr) on an unheld reference, causing a refcount underflow.
>
> Check the return value of rxe_get and bail out with an error when it fails.
>
> Cc: stable@vger.kernel.org
> Fixes: 290c4a902b79 ("RDMA/rxe: Fix \"Replace mr by rkey in responder resources\"")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> drivers/infiniband/sw/rxe/rxe_resp.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> index 9cb2f6fbf2dd..0c3f3930b494 100644
> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> @@ -514,7 +514,12 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
> if (mw->access & IB_ZERO_BASED)
> qp->resp.offset = mw->addr;
>
> - rxe_get(mr);
> + if (!rxe_get(mr)) {
Can you reproduce this (rxe_get(mr) = 0)?
Thanks a lot.
Zhu Yanjun
> + rxe_put(mw);
> + mw = NULL;
> + state = get_rkey_violation_state(pkt);
> + goto err;
> + }
> rxe_put(mw);
> mw = NULL;
> } else {
prev parent reply other threads:[~2026-06-27 1:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 15:05 [PATCH] fix: infiniband/rxe: check_rkey: fix refcount underflow due to unchecked rxe_get return value WenTao Liang
2026-06-27 1:42 ` 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=c219948e-1fd3-4bcf-8e38-0db3bfa49a6d@linux.dev \
--to=yanjun.zhu@linux.dev \
--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=vulab@iscas.ac.cn \
/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.