🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20093

Re: [PATCH net v3] net/rds: defer CM id destruction to a workqueue

#20093
From: netdev-bot+sashiko
Date: Sat, 21 Nov 2026 08:37
118 lines
11826 bytes
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
Technical Details
Message-ID: <179525025125.3135.10066600297379507793@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368294-linux-kernel-netdev=dewy.ru
References: <20261117082145.1737-1-chenaibing@cmss.chinamobile.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368294-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3] net/rds: defer CM id destruction to a workqueue
Date: Sat, 21 Nov 2026 08:37:31 +0000
Organization: Usenet Network
Message-ID: <179525025125.3135.10066600297379507793@kernel.org>
References: <20261117082145.1737-1-chenaibing@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3363082"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:tx+/lwDkFHIC6oLL/LAtGx7o1r4= sha256:ZxypAAg8uN98eriuHp9MngzlCDe9aXyxOkXi5ZvmciQ=
	sha1:85QS++qTv8wL49KfTzKdKSkiLmI= sha256:UfspoLvUcegJ4SEI55t8uP8Y21vn0wNUlW5FdtRMae0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 01939115B37; Sat, 21 Nov 2026 11:37:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 1ov7PpCarYZp;
	Sat, 21 Nov 2026 11:37:48 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368294-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id D546C115AC7; Sat, 21 Nov 2026 11:37:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 017E33E957; Sat, 21 Nov 2026 08:37:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795250253;
	b=xIataXN1F0hdNP77dAECbOV38YFJb1hyaMV393oVoO9fdR4ujYJNbMe3DytUPJJvFtGx
	 0Hfsm1QKjH0b9sEyjd69Ro2Ge05MsYAt7cYFRrOUc9NHKFX9+N7i662xN4q5ZXE/0QLhG
	 w9N9ifuJLUms0W2tMNFo925v0v0hSqaAbIQ5KaJpy5LkVUBh1M/g98eyi3ROFLWOQHWc8
	 6cw8WfgcbR0M97Tb2CBUCYMunolo1iDro5FIVhFiOkRI4bFJuVtwYjyhbiqGS9ZBJWEPv
	 8ytZhci3m6anfGjg2PhdUutni0rDsBtqvdhlVfr06m6gbOJ106EYSKCZuWFqVpdRU3g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795250253;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=k91HK40mTtE/BmAJ1Mcvc81qH3uQcXvyFodm9y1hP/w=;
	b=cQjdplWII4AWLfvE36nusk9rPzxGlsWZvYUuTeQuK6amXyefJ7w19Gvuz8yMsCjZnKQ3
	 xEXC9a9EXUggNKts4irE67Kl6Oqczh88wztlF5GmS+BFdTxulJUZac3soPo2DaegFJO/H
	 hWeZ6PqqGqhcnqvDvYPcmLMnz5alGih7N3AuFmzHe7L8uAj431btLS3mtlCsT5tR0qYte
	 OSuPMp8KA1O0iV77RFMytruPdKAxm6FyTbB9Q5+1L7TFLQoaMSywESadJNe6M/lFwA/m4
	 6BD8fPKe0yUi4U8f42wWYxD/BW0gNlAHQrlXy6GVXo3GJRlrr1OyI+xqBhvP9E3/0aQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q4kJ3hp9;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4895D606A338;
	Sat, 21 Nov 2026 08:37:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q4kJ3hp9
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795250252;
	b=y0sZEeUWVnDjx13i23UC4UMKIHBDDA0d5s/b/6IbRLnemMigwayU4Ses/wB3B2GGoEZl
	 s5Y+MGeZ9eTLnjJkr1tVIMXCyeo8Ops4VMJOzP3bu2LNz4a2/PCkCkk0IZtIZ5WfaCjs+
	 qM5jXAzRfRSmnzlIqhXA4xSwk9f38BGdEc7jXsocfFsKV44i2cTIXb5M+cvuBhnLTZzNe
	 Lp3EMEZMcp6FZGtqt0z+u1digQDlfsO2kk659XTuhjmZs9rKRQJ82Y2CuNqvnqGeJPs11
	 T12arhUfXUm2O+zP4YEILRidemdizkW0aK+sO4G8QF3bmZ81aTuziNtLXkh1I5Y5gDw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795250252;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=k91HK40mTtE/BmAJ1Mcvc81qH3uQcXvyFodm9y1hP/w=;
	b=Z0eLUr7MHut0j3RvuLvcyAoTqnV15N0vvkpO/goIX7e3Ug8zTRJQMoaAWNyVPi4HBXqX
	 q2uKOjDB+HC/edkSKgXYsPDUItlao/y9OVaGRrf522+YQVuYoTffHYJAlY1EL62fQoYT/
	 WPSwqxin/E+O3H+/aZeuoaM0QksiA3xGAVHBdYsIWmS9ytkVMyVOY7IwQvkPeOifbwDI/
	 PvMkq9szC/639IleAjW8KjwS1/D+Ntid8g/R9pdWpxK3xV5kp0ATjgnCzrdLSTWXktrYO
	 5pHRzr5kdZ6Nwza7HgravRgGOCaAw6RLeezuCfCDlIxXToUyeLNHh64DfpWQS68NfiQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q4kJ3hp9;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66C5D606A320;
	Sat, 21 Nov 2026 08:37:32 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC6541F000C0;
	Sat, 21 Nov 2026 08:37:31 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795250252;
	bh=k91HK40mTtE/BmAJ1Mcvc81qH3uQcXvyFodm9y1hP/w=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Q4kJ3hp9MJdTqS0w3N6iqenk9ff9yLPLt19Aj4YCaUxEFxFTKqW7MJ5d1111H8aPo
	 N0MjvteCaWfDHkRnC3EPR+bNF72NsQyczNgtlfn9jP5S6vCIqRhpZQI38gX3zb/vQV
	 wHDrHDgPCq0Pfy8BkMfY/mtkgJml/tTA9KbnmHRl5deTLTuRRirTADeQ2GwbMI3unv
	 MzQBhNMyvQvtWfJY9jQiGk0edycdJNAlULRfK3Jxz7a59cX/ifaFtJ3jQ8qaJCZjQZ
	 FRcziVpG+QBvNPY32h2i18LhlW1AeruE/+m9PF5khB9vgVm7O9JOWHl6WguYaW1pEp
	 /ZktjJLIYQK3A==
X-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
X-In-Reply-To: <20261117082145.1737-1-chenaibing@cmss.chinamobile.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list