From: sashiko-bot@kernel.org
To: "Yuansheng Yang" <0xbeac@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/bnxt_re: clear sq->swq pointer on error in bnxt_re_setup_qp_swqs()
Date: Sat, 05 Dec 2026 15:02:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-251672@kernel.org> (raw)
In-Reply-To: <20261205145220.1712012-1-0xbeac@gmail.com>
> In bnxt_re_setup_qp_swqs(), which only runs for kernel QPs
> (!qplqp->is_user; user QPs return early at the top of the function), if
> rq->swq allocation fails when !qplqp->srq after sq->swq has already been
> allocated, the error path frees sq->swq via kfree(sq->swq) without
> resetting sq->swq to NULL.
>
> Both callers, bnxt_qplib_create_qp1() and bnxt_qplib_create_qp(), destroy
> the firmware QP and propagate the error back to bnxt_re_create_qp(),
> whose free_hwq unwind label calls bnxt_qplib_free_qp_res(). Because
> qp->sq.swq is still non-NULL, bnxt_qplib_free_qp_res() calls
> kfree(qp->sq.swq) a second time on the already-freed buffer:
>
> BUG: KASAN: double-free in bnxt_qplib_free_qp_res
> Call Trace:
> kfree
> bnxt_qplib_free_qp_res
> bnxt_re_create_qp
>
> Clear sq->swq to NULL after freeing it in bnxt_re_setup_qp_swqs() so
> subsequent cleanup via bnxt_qplib_free_qp_res() is safe.
>
> Fixes: 13f9a813eee5 ("RDMA/bnxt_re: Refactor bnxt_qplib_create_qp() function")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yuansheng Yang <0xbeac@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205145220.1712012-1-0xbeac@gmail.com?part=1
prev parent reply other threads:[~2026-12-05 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 14:52 [PATCH] RDMA/bnxt_re: clear sq->swq pointer on error in bnxt_re_setup_qp_swqs() Yuansheng Yang
2026-12-05 15:02 ` sashiko-bot [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=sashiko-outbox-251672@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=0xbeac@gmail.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.