From: sashiko-bot@kernel.org
To: "Andrey Misiurov" <amisiurov@cloudlinux.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH v2] RDMA/ucma: reject a second join of the same multicast address
Date: Fri, 20 Nov 2026 17:52:38 +0000 [thread overview]
Message-ID: <sashiko-outbox-225735@kernel.org> (raw)
In-Reply-To: <20261120174405.2761262-1-amisiurov@cloudlinux.com>
> ucma_process_join() permits multiple joins of the same address on one
> cm_id. Each join has its own ucma_multicast, but rdma_leave_multicast()
> searches by address and removes the first match. A leave can therefore
> destroy another join's cma_multicast and free the requested ucma_multicast
> while its cma_multicast still refers to it. A later event then accesses
> freed memory.
>
> Reject duplicate addresses with -EADDRINUSE. Hold ctx->mutex across the
> duplicate check, mc_list insertion and rdma_join_multicast(). Use
> xa_alloc() to reserve the multicast ID; dropping the XArray lock during
> allocation cannot let another join bypass the check while the mutex is
> held.
>
> On leave, erase the handle under the XArray lock to claim the multicast
> object, but keep it on mc_list until ctx->mutex is acquired. Hold the
> mutex continuously from list removal through rdma_leave_multicast(),
> event cleanup and freeing the object. Otherwise a rejoin after unlinking
> could create a new membership before the old address-only leave, which
> would destroy the new membership and leave the old one referencing freed
> memory.
>
> Fixes: c8f6a362bf3e ("RDMA/cma: Add multicast communication support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120174405.2761262-1-amisiurov@cloudlinux.com?part=1
prev parent reply other threads:[~2026-11-20 17:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 17:44 [PATCH v2] RDMA/ucma: reject a second join of the same multicast address Andrey Misiurov
2026-11-20 17:52 ` 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-225735@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amisiurov@cloudlinux.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.