All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Allison Henderson" <achender@kernel.org>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next v2 8/9] net/rds: drop rds_conn_count in favor of t_conn_count
Date: Sun, 13 Sep 2026 03:50:43 +0000	[thread overview]
Message-ID: <20260913035043.DAC8C1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260912035027.27447-9-achender@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Leaking transport data for multipath connections in passive connection error paths.
--

commit 149715f475fee80907a20e835a5065660d049fe5
Author: Allison Henderson <achender@kernel.org>

net/rds: drop rds_conn_count in favor of t_conn_count

The previous patch gave each transport its own connection count in
t_conn_count, incremented and decremented at exactly the points where
the global rds_conn_count is.  This switches the name seed to
t_conn_count, and removes rds_conn_count.

> diff --git a/net/rds/connection.c b/net/rds/connection.c
> index 1ec141d6faa38..11813f93961d1 100644
> --- a/net/rds/connection.c
> +++ b/net/rds/connection.c

[ ... ]

> @@ -392,7 +392,6 @@ static struct rds_connection *__rds_conn_create(struct net *net,
>  			rds_conn_get(conn);	/* caller */
>  			rcu_assign_pointer(parent->c_passive, conn);
>  			rds_cong_add_conn(conn);
> -			rds_conn_count++;

[Severity: High]
This isn't a bug introduced by this patch, but this section of
__rds_conn_create() has a pre-existing memory leak when tearing down
passive connections.

When establishing a passive connection, if the parent's destroy has begun
or another passive connection won the race, the error paths only free
the transport data for path 0:

	if (parent) {
		/* Creating passive conn */
		if (READ_ONCE(parent->c_destroy_in_prog)) {
			...
			trans->conn_free(conn->c_path[0].cp_transport_data);
			...
		} else if (rcu_access_pointer(parent->c_passive)) {
			...
			trans->conn_free(conn->c_path[0].cp_transport_data);
			...

Since conn_alloc() can allocate transport data for multiple paths (npaths),
doesn't freeing only c_path[0] permanently leak the transport-specific
connection data (like rds_tcp_connection) for paths 1 through npaths-1?

The normal connection error path just below this handles it correctly by
looping over all npaths:

		if (found) {
			for (i = 0; i < npaths; i++) {
				cp = &conn->c_path[i];
				if (cp->cp_transport_data)
					trans->conn_free(cp->cp_transport_data);
			}
		}

Could the passive error paths also be updated to iterate over all paths and
prevent this resource leak?

>  			atomic_inc(&conn->c_trans->t_conn_count);
>  		}
>  	} else {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912035027.27447-1-achender@kernel.org?part=8

  reply	other threads:[~2026-09-13  3:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12  3:50 [PATCH net-next v2 0/9] net/rds: make connection lifetime reference-counted Allison Henderson
2026-09-12  3:50 ` [PATCH net-next v2 1/9] net/rds: guard every work-requeueing site with rds_destroy_pending() Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 2/9] net/rds: make rds_destroy_pending() cover single-connection destroy Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 3/9] net/rds: split connection destroy into quiesce and kref-governed free Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 4/9] net/rds: wait for connections to be freed on transport unload Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 5/9] net/rds: unlink transport nodes before a possibly deferred connection free Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 6/9] net/rds: hold connection references in lookup, sockets and c_passive Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 7/9] net/rds: pin the connection across RDMA-CM event handling Allison Henderson
2026-09-13  3:50   ` sashiko-bot
2026-09-12  3:50 ` [PATCH net-next v2 8/9] net/rds: drop rds_conn_count in favor of t_conn_count Allison Henderson
2026-09-13  3:50   ` sashiko-bot [this message]
2026-09-12  3:50 ` [PATCH net-next v2 9/9] net/rds: hold a connection reference from struct rds_incoming Allison Henderson
2026-09-13  3:50   ` sashiko-bot

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=20260913035043.DAC8C1F00893@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 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.