Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: achender@kernel.org
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	pabeni@redhat.com, edumazet@google.com, kuba@kernel.org,
	horms@kernel.org, nicoyip.dev@gmail.com
Subject: Re: [PATCH net-next v4 12/12] net/rds: hold a connection reference from struct rds_incoming
Date: Mon, 21 Sep 2026 09:15:40 +0000	[thread overview]
Message-ID: <178998214084.2160803.755745892282571698@kernel.org> (raw)
In-Reply-To: <20260917073958.174056-13-achender@kernel.org>

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

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] The commit message's reachability claim — "reaching the use-
  after-free requires freeing a connection out from under a live socket,…
- [Low] The patch closes a reported, KASAN-confirmed use-after-free
  (`rds6_inc_info_copy()` reading a freed `rds_connection` via…

--

net/rds: hold a connection reference from struct rds_incoming

This makes every assignment of rds_incoming->i_conn take a connection
reference, dropped from rds_inc_put() and from the new rds_message_free()
helper, so a connection stays allocated while incs that arrived over it
are still queued on socket receive queues.

Closes: https://lore.kernel.org/netdev/20260720184955.3008978-1-nicoyip.dev@gmail.com/

The two comments below are about the changelog only, so the diff hunks
are snipped.

>     This is not a stable candidate: reaching the use-after-free requires
>     freeing a connection out from under a live socket, which needs
>     CAP_SYS_MODULE, netns teardown or physical device removal, and the fix
>     depends on the connection reference counting introduced earlier in this
>     series.

[Severity: Medium]
Is this list of prerequisites complete?  There looks to be a fourth way
to free a live connection that needs none of the three, in
rds_ib_cm_connect_complete():

net/rds/ib_cm.c:rds_ib_cm_connect_complete() {
	dp = event->param.conn.private_data;
	...
		major = dp->ricp_v4.dp_protocol_major;
		minor = dp->ricp_v4.dp_protocol_minor;
	...
	if (major) {
		rds_ib_set_protocol(conn, RDS_PROTOCOL(major, minor));
	...
	if (conn->c_version < RDS_PROTOCOL_VERSION) {
		if (conn->c_version != RDS_PROTOCOL_COMPAT_VERSION) {
			pr_notice("RDS/IB: Connection <%pI6c,%pI6c> version %u.%u no longer supported\n", ...);
			rds_conn_destroy(conn);
			return;
		}
	}
}

The version comes from the peer's CM private data, and this callback is
reached from live event handling:

rds_rdma_cm_event_handler_cmn() -> RDMA_CM_EVENT_ESTABLISHED
  -> trans->cm_connect_complete()
    -> rds_ib_cm_connect_complete()
      -> rds_conn_destroy()

Since the same struct rds_connection is reused across reconnects for a
given laddr/faddr/tos tuple, can a reconnect on which the peer advertises
an unsupported version destroy a connection that unread incs from the
previous session still point at, without CAP_SYS_MODULE, netns teardown or
device removal?

If so, could the paragraph be reworded to cover that path, and the stable
reasoning re-derived from it?  The dependency on the reference counting
introduced earlier in the series is a separate argument.

One related note: the sibling patch "net/rds: pin the connection across
RDMA-CM event handling" states this call "has meanwhile been switched to
rds_conn_drop() by commit f97d8c7bab78", but at this revision
rds_ib_cm_connect_complete() still calls rds_conn_destroy(conn).  Which of
the two is right?

>     Reported-by: Chengfeng Ye <nicoyip.dev@gmail.com>
>     Closes: https://lore.kernel.org/netdev/20260720184955.3008978-1-nicoyip.dev@gmail.com/

[Severity: Low]
Should this carry a Fixes: tag for the commit that introduced the bare
i_conn assignment in rds_inc_init()?

The changelog documents two user-visible crashes, the KASAN report in
rds6_inc_info_copy() and the panic in rds_ib_inc_free(), and the second
one is reachable on the pre-series code, where nothing keeps the
connection alive for a queued inc:

net/rds/ib_recv.c:rds_ib_inc_free() {
	struct rds_ib_connection *ic = inc->i_conn->c_transport_data;
	...
	rds_ib_recv_cache_put(&ibinc->ii_cache_entry, &ic->i_cache_incs);
}

reached by rds_release() -> rds_clear_recv_queue() -> rds_inc_put().

The other patches in this series that fix pre-existing defects do carry
one (e266df6b -> Fixes: 745cbccac3fe, 23531807 -> Fixes: 1c5113cf796b,
d4f3ede0 -> Fixes: ebeeb1ad9b8a, ef753cfe -> Fixes: cdc306a5c9cd3), so
this one looks inconsistent with the rest.  Even if no backport is
possible because the fix depends on the earlier reference counting, would
naming the introducing commit, or stating which kernels are exposed, help
downstream trees decide whether they are affected?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260917073958.174056-1-achender%40kernel.org

      reply	other threads:[~2026-09-21  9:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  7:39 [PATCH net-next v4 00/12] net/rds: make connection lifetime reference-counted Allison Henderson
2026-09-17  7:39 ` [PATCH net-next v4 01/12] net/rds: ib: don't enable interrupts in rds_ib_conn_free() Allison Henderson
2026-09-17  7:39 ` [PATCH net-next v4 02/12] net/rds: free every path's transport data on the passive create paths Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 03/12] net/rds: guard every work-requeueing site with rds_destroy_pending() Allison Henderson
2026-09-17  7:39 ` [PATCH net-next v4 04/12] net/rds: make rds_destroy_pending() cover single-connection destroy Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 05/12] net/rds: split connection destroy into quiesce and kref-governed free Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 06/12] net/rds: wait for connections to be freed on transport unload Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 07/12] net/rds: unlink transport nodes before a possibly deferred connection free Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 08/12] net/rds: hold connection references in lookup, sockets and c_passive Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 09/12] net/rds: refuse to queue on a connection being destroyed Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 10/12] net/rds: pin the connection across RDMA-CM event handling Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko
2026-09-17  7:39 ` [PATCH net-next v4 11/12] net/rds: drop rds_conn_count in favor of t_conn_count Allison Henderson
2026-09-17  7:39 ` [PATCH net-next v4 12/12] net/rds: hold a connection reference from struct rds_incoming Allison Henderson
2026-09-21  9:15   ` netdev-bot+sashiko [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=178998214084.2160803.755745892282571698@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=achender@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicoyip.dev@gmail.com \
    --cc=pabeni@redhat.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