From: sashiko-bot@kernel.org
To: "Jiayi Zhang" <zhangjiayi1014@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/cma: Cancel the route query before dropping handler_mutex on removal
Date: Sun, 06 Dec 2026 13:33:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-252447@kernel.org> (raw)
In-Reply-To: <20261206131441.1767711-1-zhangjiayi1014@gmail.com>
> When an RDMA device is removed, cma_send_device_removal_put() moves the
> ID to RDMA_CM_DEVICE_REMOVAL, delivers the event to the ULP, drops
> handler_mutex and then calls cma_cancel_operation() with the previous
> state.
>
> The ULP may destroy the ID as soon as handler_mutex is dropped; ucma
> does this from its close_work. destroy_id_handler_unlock() sees
> RDMA_CM_DEVICE_REMOVAL, leaves the cancel to the removal thread, and
> _destroy_id() calls cma_release_dev(), which sets id_priv->id.device to
> NULL. The reference held by the removal thread keeps id_priv alive, but
> if the previous state was RDMA_CM_ROUTE_QUERY, cma_cancel_route() then
> reads the cleared device:
>
> KASAN: null-ptr-deref in range [0x0000000000000798-0x000000000000079f]
> RIP: 0010:rdma_cap_ib_sa include/rdma/ib_verbs.h:3563 [inline]
> [ ... ]
> Fixes: 3647a28de1ad ("RDMA/cma: Using the standard locking pattern when delivering the removal event")
> Fixes: 889d916b6f8a ("RDMA/core: Don't access cm_id after its destruction")
> Reported-by: syzbot+9a9d0804227064a915d3@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6b14cd41.7375a9b9.1d867b.10ff.GAE@google.com/
> Signed-off-by: Jiayi Zhang <zhangjiayi1014@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206131441.1767711-1-zhangjiayi1014@gmail.com?part=1
prev parent reply other threads:[~2026-12-06 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 13:14 [PATCH] RDMA/cma: Cancel the route query before dropping handler_mutex on removal Jiayi Zhang
2026-12-06 13:33 ` 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-252447@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhangjiayi1014@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox