From: sashiko-bot@kernel.org
To: "Allison Henderson" <achender@kernel.org>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next v7 05/12] net/rds: split connection destroy into quiesce and kref-governed free
Date: Mon, 28 Sep 2026 06:15:02 +0000 [thread overview]
Message-ID: <20260928061503.67F541F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20260927061448.167862-6-achender@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: rds: permanent connection leak via orphaned probe message on concurrent teardown
--
commit 85ee160094b05c4fe02ec81d1c727379b584a32f
Author: Sharath Srinivasan <sharath.srinivasan@oracle.com>
net/rds: split connection destroy into quiesce and kref-governed free
This commit introduces a refcounting framework for RDS connections, splitting
the teardown process into synchronous quiescing and deferred freeing triggered
when the last reference is dropped.
> diff --git a/net/rds/connection.c b/net/rds/connection.c
> index cbc49426ba085..638e9f3140e28 100644
> --- a/net/rds/connection.c
> +++ b/net/rds/connection.c
[ ... ]
> @@ -567,16 +581,55 @@ static void rds_conn_path_destroy(struct rds_conn_path *cp)
> cp->cp_conn->c_trans->conn_free(cp->cp_transport_data);
> }
>
> +/* Free a connection. This runs from rds_conn_put() when the last
> + * reference is dropped, after rds_conn_destroy() has quiesced the
> + * connection and dropped the initial reference.
> + */
> +static void rds_conn_destroy_fini(struct kref *kref)
> +{
> + struct rds_connection *conn = container_of(kref, struct rds_connection,
> + c_refcount);
> + int npaths = (conn->c_trans->t_mp_capable ? RDS_MPATH_WORKERS : 1);
> + unsigned long flags;
> + int i;
> +
> + for (i = 0; i < npaths; i++)
> + rds_conn_path_free(&conn->c_path[i]);
> +
> + kfree(conn->c_path);
[Severity: High]
Does this code leak the connection and its associated memory if a probe message
is queued concurrently during teardown?
If a concurrent sendmsg() is preempted after checking rds_destroy_pending(),
and rds_conn_destroy() completes rds_conn_path_quiesce() which purges
cp_send_queue, the resumed sendmsg() can call rds_send_ping() ->
rds_send_probe().
In rds_send_probe(), the message is added to cp_send_queue and a connection
reference is taken:
net/rds/send.c:rds_send_probe() {
...
spin_lock_irqsave(&cp->cp_lock, flags);
list_add_tail(&rm->m_conn_item, &cp->cp_send_queue);
...
rds_conn_get(cp->cp_conn);
...
if (!rds_destroy_pending(cp->cp_conn))
queue_delayed_work(cp->cp_wq, &cp->cp_send_w, 1);
...
}
Because rds_destroy_pending() is now true, the worker isn't queued. Since the
probe message lacks an associated socket (rm->m_rs == NULL), closing the
socket won't purge the message via rds_send_drop_to().
Because rds_conn_destroy_fini() does not traverse or drain cp_send_queue, it
seems the connection reference taken by rds_send_probe() will never be dropped.
This could lead to a permanent leak of the connection and stall module unloads
in rds_conn_wait_conns_freed().
> + kmem_cache_free(rds_conn_slab, conn);
> +
> + spin_lock_irqsave(&rds_conn_lock, flags);
> + rds_conn_count--;
> + spin_unlock_irqrestore(&rds_conn_lock, flags);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927061448.167862-1-achender@kernel.org?part=5
next prev parent reply other threads:[~2026-09-28 6:15 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 6:14 [PATCH net-next v7 00/12] net/rds: make connection lifetime reference-counted Allison Henderson
2026-09-27 6:14 ` [PATCH net-next v7 01/12] net/rds: ib: don't enable interrupts in rds_ib_conn_free() Allison Henderson
2026-09-28 6:14 ` sashiko-bot
2026-09-27 6:14 ` [PATCH net-next v7 02/12] net/rds: undo conn_alloc() the same way on every __rds_conn_create() exit Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-09-27 6:14 ` [PATCH net-next v7 03/12] net/rds: guard every work-requeueing site with rds_destroy_pending() Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 04/12] net/rds: make rds_destroy_pending() report a connection's own destroy Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 05/12] net/rds: split connection destroy into quiesce and kref-governed free Allison Henderson
2026-09-28 6:15 ` sashiko-bot [this message]
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 06/12] net/rds: wait for connections to be freed on transport unload Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 07/12] net/rds: unlink transport nodes before a possibly deferred connection free Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 08/12] net/rds: hold a connection reference from struct rds_incoming Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 09/12] net/rds: take cp_lock to purge cp_send_queue in the quiesce Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 10/12] net/rds: hold connection references in lookup, sockets and c_passive Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 11/12] net/rds: pin the connection across RDMA-CM event handling Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-09-27 6:14 ` [PATCH net-next v7 12/12] net/rds: drop rds_conn_count in favor of t_conn_count Allison Henderson
2026-09-28 6:15 ` sashiko-bot
2026-10-01 6:16 ` netdev-bot+sashiko
2026-10-02 19:37 ` [PATCH net-next v7 00/12] net/rds: make connection lifetime reference-counted Jakub Kicinski
2026-10-02 21:26 ` 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=20260928061503.67F541F0089B@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=achender@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox