From: sashiko-bot@kernel.org
To: "Dongliang Qin" <cccccccccccc777777@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net v2] rds: ib: Clear the sg list when mapping an MR fails
Date: Tue, 22 Sep 2026 03:25:13 +0000 [thread overview]
Message-ID: <20260922032514.140431F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922031546.3874605-1-cccccccccccc777777@gmail.com>
> rds_ib_map_frmr() stores the caller's scatterlist in the MR before DMA
> mapping and registration can fail. On failure, __rds_rdma_map() unpins
> the pages and frees the scatterlist, but rds_ib_free_frmr() can still
> return the MR to the pool with the stale pointer set.
>
> This leaves the pool with a dangling scatterlist and can lead to local
> privilege escalation. KASAN detects the resulting use-after-free when the
> MR is later torn down:
>
> BUG: KASAN: slab-use-after-free in __rds_ib_teardown_mr
> Read of size 8
>
> Call Trace:
> __rds_ib_teardown_mr
> rds_ib_unreg_frmr
> rds_ib_flush_mr_pool
> rds_ib_flush_mrs
> rds_free_mr
> rds_setsockopt
>
> Store the scatterlist in the MR only after DMA mapping succeeds. If DMA
> mapping fails, return directly while the MR fields remain clear; the caller
> keeps ownership of the scatterlist and its pinned pages. If a later
> registration step fails, unmap the scatterlist and clear the MR fields
> before returning.
>
> Fixes: 1659185fb4d0 ("RDS: IB: Support Fastreg MR (FRMR) memory registration mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dongliang Qin <cccccccccccc777777@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922031546.3874605-1-cccccccccccc777777@gmail.com?part=1
next prev parent reply other threads:[~2026-09-22 3:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 3:15 [PATCH net v2] rds: ib: Clear the sg list when mapping an MR fails Dongliang Qin
2026-09-22 3:25 ` sashiko-bot [this message]
2026-09-23 7:05 ` Allison Henderson
2026-09-24 11:30 ` patchwork-bot+netdevbpf
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=20260922032514.140431F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cccccccccccc777777@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox