Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: lirongqing <lirongqing@baidu.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	Stefan Metzmacher <metze@samba.org>, Kees Cook <kees@kernel.org>,
	Or Gerlitz <ogerlitz@ddn.com>,
	Norbert Szetei <norbert@doyensec.com>,
	Marco Crivellari <marco.crivellari@suse.com>,
	Vlad Dumitrescu <vdumitrescu@nvidia.com>,
	Mark Zhang <markzhang@nvidia.com>,
	Or Har-Toov <ohartoov@nvidia.com>,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/cma: publish service records after initializing them
Date: Sun, 6 Sep 2026 09:13:52 +0300	[thread overview]
Message-ID: <20260906061352.GA13683@unreal> (raw)
In-Reply-To: <20260826110213.18378-1-lirongqing@baidu.com>

On Wed, Aug 26, 2026 at 07:02:13PM +0800, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
> 
> cma_query_ib_service_handler() stores the freshly allocated
> service_recs array and its count before the records are filled in:
> 
> 	id_priv->id.route.service_recs = kmalloc_objs(*recs, num_recs);
> 	...
> 	id_priv->id.route.num_service_recs = num_recs;
> 	memcpy(id_priv->id.route.service_recs, recs, ...);
> 
> ucma_query_ib_service() only holds ctx->mutex and is not serialized
> against this SA callback.

No, this sentence is wrong.
ucma_query_ib_service() holds ctx->mutex and cma_query_ib_service_handler()
is executed under same mutex too.

mutex_lock(&ctx->mutex)
rdma_resolve_ib_service() ->
	cma_resolve_ib_service() ->
		ib_sa_service_rec_get() ->
			cma_query_ib_service_handler()

Thanks

      reply	other threads:[~2026-09-06  6:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 11:02 [PATCH] RDMA/cma: publish service records after initializing them lirongqing
2026-09-06  6:13 ` Leon Romanovsky [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=20260906061352.GA13683@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=kees@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=marco.crivellari@suse.com \
    --cc=markzhang@nvidia.com \
    --cc=metze@samba.org \
    --cc=norbert@doyensec.com \
    --cc=ogerlitz@ddn.com \
    --cc=ohartoov@nvidia.com \
    --cc=vdumitrescu@nvidia.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