From: netdev-bot+sashiko@kernel.org
To: dhowells@redhat.com
Cc: netdev@vger.kernel.org, marc.dionne@auristor.com,
kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
nicoyip.dev@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH net v9 05/14] rxrpc: Fix sendmsg length
Date: Tue, 08 Sep 2026 20:49:41 +0000 [thread overview]
Message-ID: <178890058197.219967.4772442407824691930@kernel.org> (raw)
In-Reply-To: <20260907113743.1453210-6-dhowells@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 0 · Low: 1
- [Low] "rxrpc: Fix sendmsg length" carries a `Fixes:` tag and `cc:
stable@vger.kernel.org` while its own commit message states…
--
rxrpc: Fix sendmsg length
This makes rxrpc_send_data() consistently use its len argument rather than
msg->msg_iter.count, decrementing len as data is copied, and limits each
copy to the smaller of len and msg_data_left(msg).
> diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
> index 1d66e98081624..565799548102c 100644
> --- a/net/rxrpc/sendmsg.c
> +++ b/net/rxrpc/sendmsg.c
> @@ -379,9 +379,9 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
>
> ret = -EMSGSIZE;
> if (call->tx_total_len != -1) {
> - if (len - copied > call->tx_total_len)
> + if (len > call->tx_total_len)
> goto maybe_error;
> - if (!more && len - copied != call->tx_total_len)
> + if (!more && len != call->tx_total_len)
> goto maybe_error;
> }
[Severity: Low]
This isn't a bug in the code, but a question about the tagging. The
commit carries:
Fixes: 382d7974de31 ("RxRPC: Use iov_iter_count() in rxrpc_send_data() instead of the len argument")
cc: stable@vger.kernel.org
while the message itself says:
Note that, currently, all the callers have len and msg->msg_iter.count the
same and so the problem won't occur.
Walking the callers agrees with that statement. rxrpc_do_sendmsg()
forwards the sendmsg() len that the syscall also used to build msg_iter.
In fs/afs/rxrpc.c, afs_make_call() and afs_send_simple_reply() pass
msg_data_left(&msg):
ret = rxrpc_kernel_send_data(call->net->socket, rxcall, &msg,
msg_data_left(&msg),
afs_notify_end_request_tx);
and afs_send_empty_reply() passes 0 for a zero-length iterator. In
net/rxrpc/rxperf.c, rxperf_process_call() passes the same local len used
to build the iterator:
iov_iter_bvec(&msg.msg_iter, WRITE, &bv, 1, len);
msg.msg_flags = MSG_MORE;
n = rxrpc_kernel_send_data(rxperf_socket, call->rxcall, &msg,
len, rxperf_notify_end_reply_tx);
So no in-tree caller can diverge. Given there is no symptom, reproducer
or affected caller named, are the Fixes: and cc: stable tags intended
here?
What stable trees would pick up instead is a rewrite of the sendmsg data
loop: len becomes mutable and is decremented in the loop, the copy bound
becomes min3(), the loop termination test gains a second clause, and the
-EMSGSIZE re-check that is re-executed via the reload label now tests the
decremented len instead of len - copied.
>
> @@ -405,7 +405,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
> * the security header is going to be in the padded
> * region (enc blocksize), but the trailer is not.
> */
> - remain = more ? INT_MAX : msg_data_left(msg);
> + remain = more ? INT_MAX : len;
> txb = call->conn->security->alloc_txbuf(call, remain, sk->sk_allocation);
> if (!txb) {
> ret = -ENOMEM;
> @@ -416,8 +416,8 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
> _debug("append");
>
> /* append next segment of data to the current buffer */
> - if (msg_data_left(msg) > 0) {
> - size_t copy = umin(txb->space, msg_data_left(msg));
> + if (len > 0) {
> + size_t copy = min3(txb->space, len, msg_data_left(msg));
>
> _debug("add %zu", copy);
> if (!copy_from_iter_full(txb->data + txb->offset,
> @@ -428,6 +428,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
> txb->len += copy;
> txb->offset += copy;
> copied += copy;
> + len -= copy;
> if (call->tx_total_len != -1)
> call->tx_total_len -= copy;
> }
> @@ -439,8 +440,8 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
>
> /* add the packet to the send queue if it's now full */
> if (!txb->space ||
> - (msg_data_left(msg) == 0 && !more)) {
> - if (msg_data_left(msg) == 0 && !more)
> + (len == 0 && !more)) {
> + if (len == 0 && !more)
> txb->flags |= RXRPC_LAST_PACKET;
>
> ret = call->security->secure_packet(call, txb);
> @@ -449,7 +450,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
> rxrpc_queue_packet(rx, call, txb, notify_end_tx);
> txb = NULL;
> }
> - } while (msg_data_left(msg) > 0);
> + } while (len > 0 && msg_data_left(msg) > 0);
Making len mutable also appears to be a prerequisite for the later patch
in the series, "rxrpc: Fix packet encryption error handling", whose rewind
path tests:
if (copied && !more && !len) {
which only behaves as intended once len is decremented here. Could that
dependency be mentioned in the commit message?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260907113743.1453210-1-dhowells%40redhat.com
next prev parent reply other threads:[~2026-09-08 20:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 11:37 [PATCH net v9 00/14] rxrpc: Miscellaneous fixes David Howells
2026-09-07 11:37 ` [PATCH net v9 01/14] afs: Fix lack of loop around sendmsg() to rxrpc David Howells
2026-09-07 13:06 ` David Laight
2026-09-10 10:18 ` David Howells
2026-09-07 11:37 ` [PATCH net v9 02/14] afs: Fix afs to abort the rxrpc call on send error David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 03/14] rxrpc: Fix lack of loop around reply send in rxperf server David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 04/14] rxrpc: Fix sendmsg to not return an error if last packet queued David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 05/14] rxrpc: Fix sendmsg length David Howells
2026-09-08 20:49 ` netdev-bot+sashiko [this message]
2026-09-07 11:37 ` [PATCH net v9 06/14] rxrpc: Fix packet encryption error handling David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 07/14] rxrpc: Fix update of call->tx_pending without holding lock David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 08/14] rxrpc: Fix double IRQ enablement David Howells
2026-09-07 11:37 ` [PATCH net v9 09/14] rxrpc: Fix generation of notifications after call completion David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 10/14] rxrpc: Fix RxGK key parser to check enctype is supported David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 11/14] afs: Fix creation of RxGK CM channel token to have right size David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 12/14] afs: Fix lack of setting call->server when doing FS.InlineBulkStatus David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 13/14] rxrpc: fix use-after-free in rxrpc_poke_conn() David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
2026-09-07 11:37 ` [PATCH net v9 14/14] rxrpc: Take write lock when publishing the initial RxGK key David Howells
2026-09-08 20:49 ` netdev-bot+sashiko
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=178890058197.219967.4772442407824691930@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=nicoyip.dev@gmail.com \
--cc=pabeni@redhat.com \
--cc=stable@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
all inboxes | Powered by JetHome®