Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
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, jhubbard@nvidia.com, leon@kernel.org
Subject: Re: [PATCH net-next v2 2/2] net/rds: initialize i_conn_path in rds_inc_init()
Date: Thu, 13 Aug 2026 11:44:26 +0200	[thread overview]
Message-ID: <20260813094426.120571-1-pabeni@redhat.com> (raw)
In-Reply-To: <20260809005103.82371-3-achender@kernel.org>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://netdev-ai.bots.linux.dev/sashiko/
---
net/rds: initialize i_conn_path in rds_inc_init()

This sets inc->i_conn_path to NULL in rds_inc_init() so the field is no
longer left holding stale slab contents, and switches rds_loop_xmit() to
rds_inc_path_init() so the loopback path keeps a live path pointer in the
message's embedded inc.

> diff --git a/net/rds/loop.c b/net/rds/loop.c
> index ac9295a766b1..e6b0750bbeda 100644
> --- a/net/rds/loop.c
> +++ b/net/rds/loop.c
> @@ -89,7 +89,11 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm,
>  
>  	BUG_ON(hdr_off || sg || off);
>  
> -	rds_inc_init(&rm->m_inc, conn, &conn->c_laddr);
> +	/* rds_send_queue_rm() stored the connection path in this embedded
> +	 * inc; use the path init so the re-initialization keeps the field
> +	 * valid instead of discarding it.
> +	 */
> +	rds_inc_path_init(&rm->m_inc, &conn->c_path[0], &conn->c_laddr);

[Severity: Medium]
Does this swap silently drop the i_rx_lat_trace[] zeroing for loopback
incs?  rds_inc_init() in net/rds/recv.c ends with:

	inc->i_usercopy.rx_tstamp = ktime_set(0, 0);

	memset(inc->i_rx_lat_trace, 0, sizeof(inc->i_rx_lat_trace));

while rds_inc_path_init() stops at:

	inc->i_usercopy.rx_tstamp = ktime_set(0, 0);
}
EXPORT_SYMBOL_GPL(rds_inc_path_init);

So after this change nothing in rds_loop_xmit() clears the array, and
the RDS_MSG_RX_HDR and RDS_MSG_RX_START slots (written only by
net/rds/ib_recv.c and net/rds/tcp_recv.c, never on the loopback path)
are left to whatever rds_message_alloc()'s kzalloc() left behind rather
than being explicitly initialized.

The array is handed to userspace as RDS_CMSG_RXPATH_LATENCY deltas in
rds_cmsg_recv():

	inc->i_rx_lat_trace[RDS_MSG_RX_CMSG] = local_clock();
	...
		t.rx_trace[i] = inc->i_rx_lat_trace[j + 1] -
				  inc->i_rx_lat_trace[j];

Would it be preferable to move the memset() into rds_inc_path_init(), or
have rds_inc_path_init() call rds_inc_init() and then assign
i_conn_path?  That would also cover the other rds_inc_path_init() caller
in rds_tcp_data_recv(), where tinc comes from a recycled, non-zeroing
kmem_cache and therefore keeps the same stale-field property this patch
sets out to remove.

>  	/* For the embedded inc. Matching put is in loop_inc_free() */
>  	rds_message_addref(rm);
>  
> diff --git a/net/rds/recv.c b/net/rds/recv.c
> index cf3884d87931..f1513dfb2716 100644
> --- a/net/rds/recv.c
> +++ b/net/rds/recv.c
> @@ -47,6 +47,7 @@ void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn,
>  	refcount_set(&inc->i_refcount, 1);
>  	INIT_LIST_HEAD(&inc->i_item);
>  	inc->i_conn = conn;
> +	inc->i_conn_path = NULL;
>  	inc->i_saddr = *saddr;
>  	inc->i_usercopy.rdma_cookie = 0;
>  	inc->i_usercopy.rx_tstamp = ktime_set(0, 0);

[Severity: Medium]
Related to the above, the commit message says:

    "and so the two init helpers
    (rds_inc_init/rds_inc_path_init) leave the structure in an
    equivalent, fully-initialized state."

Does that hold after this patch?  rds_inc_init() gains i_conn_path = NULL
here, but rds_inc_path_init() still lacks the
memset(inc->i_rx_lat_trace, 0, sizeof(inc->i_rx_lat_trace)) that
rds_inc_init() performs, so the two helpers leave i_rx_lat_trace[] in
different states.  Could the changelog be adjusted, or the missing
memset() added to rds_inc_path_init() so the claim is accurate?
-- 
This is an AI-generated review.


  reply	other threads:[~2026-08-13  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-09  0:51 [PATCH net-next v2 0/2] net/rds: Bug fix ports, part 2 Allison Henderson
2026-08-09  0:51 ` [PATCH net-next v2 1/2] net/rds: reinitialize to_be_dropped on rds_send_xmit() restart Allison Henderson
2026-08-09  0:51 ` [PATCH net-next v2 2/2] net/rds: initialize i_conn_path in rds_inc_init() Allison Henderson
2026-08-13  9:44   ` Paolo Abeni [this message]
2026-08-11  8:37 ` [PATCH net-next v2 0/2] net/rds: Bug fix ports, part 2 Simon Horman
2026-08-13 11:00 ` patchwork-bot+netdevbpf

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=20260813094426.120571-1-pabeni@redhat.com \
    --to=pabeni@redhat.com \
    --cc=achender@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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