From: netdev-bot+sashiko@kernel.org
To: chenaibing@cmss.chinamobile.com
Cc: achender@kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] net/rds: defer CM id destruction to a workqueue
Date: Sat, 21 Nov 2026 08:37:31 +0000 [thread overview]
Message-ID: <179525025125.3135.10066600297379507793@kernel.org> (raw)
In-Reply-To: <20261117082145.1737-1-chenaibing@cmss.chinamobile.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] Each call to rds_ib_laddr_check_cm() (net/rds/ib.c) now
allocates a work item (kzalloc_obj(*w, GFP_KERNEL), line 439) and an…
--
net/rds: defer CM id destruction to a workqueue
This commit moves the rdma_destroy_id() call in rds_ib_laddr_check_cm()
to a work item on rds_wq, so rds_trans_sem is released before
handler_mutex is taken. The work item is allocated before the CM id is
created, and the address check fails with -ENOMEM if that allocation
fails. rds_ib_exit() now flushes rds_wq after unregistering the transport.
Closes: https://syzkaller.appspot.com/bug?extid=ccdb5058c3df2d94811c
> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index 4ea9838d090c3..44b46defa1ae0 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
[ ... ]
> @@ -411,14 +425,28 @@ static int rds_ib_laddr_check_cm(struct net *net, const struct in6_addr *addr,
[ ... ]
> + w = kzalloc_obj(*w, GFP_KERNEL);
> + if (!w)
> + return -ENOMEM;
> +
> /* Create a CMA ID restricted to IB devices and try to bind it. */
> cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
> NULL, RDMA_PS_TCP, IB_QPT_RC);
[ ... ]
> @@ -484,7 +512,9 @@ static int rds_ib_laddr_check_cm(struct net *net, const struct in6_addr *addr,
> cm_id->device ? cm_id->device->node_type : -1);
>
> out:
> - rdma_destroy_id(cm_id);
> + INIT_WORK(&w->work, rds_ib_destroy_id_work);
> + w->cm_id = cm_id;
> + queue_work(rds_wq, &w->work);
>
> return ret;
> }
[Severity: Medium]
Is there anything that limits how many of these destroys can be pending?
Before this change, rdma_destroy_id() ran synchronously. The number of
live cm_ids could never exceed the number of threads inside bind() at
that moment.
Now each call keeps two objects allocated until the krdsd worker gets to
the item: the work item and the rdma_id_private from rdma_create_id().
The caller returns right away, so the producer gets no backpressure.
An unprivileged user can reach this by calling bind() in a loop on an
AF_RDS socket, using an address that no IB device owns:
rds_bind()
rds_trans_get_preferred()
rds_ib_laddr_check()
rds_ib_laddr_check_cm()
kzalloc_obj(*w, GFP_KERNEL)
rdma_create_id()
...
queue_work(rds_wq, &w->work)
A failed laddr_check leaves the socket unbound, so the same socket can
call bind() again at once. The rds_rdma module has to be loaded, but it
can be autoloaded through SO_RDS_TRANSPORT.
Neither allocation uses __GFP_ACCOUNT. Could the pending objects pile up
as kernel memory that is never charged to the caller's memcg?
rds_threads_init() creates rds_wq with
create_singlethread_workqueue("krdsd"). That leaves one ordered worker to
drain items that can be queued from many CPUs.
The same workqueue also handles other RDS work:
- the cp_wq for RDS IB and TCP connection paths
- the TCP accept worker
- message unpin work
- rds_ib_dev_free()
Could a backlog of destroy items hold up connection, accept and teardown
work for every RDS user on the system?
When rdma_bind_addr() succeeds (for example IPv6 on IPoIB), each pending
cm_id also holds an RDMA_PS_TCP port until its destroy runs.
There are a few possible ways around this:
- return the cm_id to the caller and destroy it after
up_read(&rds_trans_sem)
- limit the number of in-flight destroys
- use a dedicated unordered workqueue and add __GFP_ACCOUNT
Would one of these work here?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117082145.1737-1-chenaibing%40cmss.chinamobile.com
next prev parent reply other threads:[~2026-11-21 8:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 15:05 [PATCH] RDMA/cma: add rdma_destroy_id_wq() and use it from RDS Aibing Chen
2026-11-15 0:18 ` Jason Gunthorpe
2026-11-16 6:47 ` Allison Henderson
2026-11-16 7:54 ` [PATCH net v2] net/rds: defer CM id destruction to a workqueue Aibing Chen
2026-11-17 6:15 ` Allison Henderson
2026-11-17 8:21 ` [PATCH net v3] " Aibing Chen
2026-11-21 8:37 ` netdev-bot+sashiko [this message]
2026-11-17 8:35 ` [PATCH net v2] " netdev-bot+sashiko
2026-11-19 6:33 ` Allison Henderson
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=179525025125.3135.10066600297379507793@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=achender@kernel.org \
--cc=chenaibing@cmss.chinamobile.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rds-devel@oss.oracle.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