From: netdev-bot+sashiko@kernel.org
To: cel@kernel.org
Cc: john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net,
davem@davemloft.net, pabeni@redhat.com, horms@kernel.org,
davejwatson@fb.com, shuah@kernel.org, qingfang.deng@linux.dev,
edumazet@kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v6 1/9] tls: Bound consecutive no-data records in tls_sw_read_sock()
Date: Thu, 22 Oct 2026 19:57:35 +0000 [thread overview]
Message-ID: <179269905526.1189532.975361221217060549@kernel.org> (raw)
In-Reply-To: <20261019-tls-follow-on-v6-1-ab01c4ecca0c@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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] When the new TLS_RX_NODATA_LIMIT break fires,
tls_sw_read_sock() queues data_ready_work only if…
--
tls: Bound consecutive no-data records in tls_sw_read_sock()
This patch stops tls_sw_read_sock() after TLS_RX_NODATA_LIMIT consecutive
zero-length data records. If a parsed record is ready when the loop stops,
a work item on tls_strp_wq runs the consumer's current sk_data_ready(),
because tls_rx_reader_release() only wakes saved_data_ready.
> diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
> index 312e51270f29..0ef0edd51edd 100644
> --- a/net/tls/tls_sw.c
> +++ b/net/tls/tls_sw.c
[ ... ]
> @@ -2144,6 +2161,16 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc,
> */
> if (rxm->full_len == 0) {
> consume_skb(skb);
> + if (++nodata >= TLS_RX_NODATA_LIMIT) {
> + /* tls_rx_reader_release() wakes only the
> + * callback saved when TLS_RX was set up,
> + * not one installed since.
> + */
> + if (tls_strp_msg_ready(ctx))
> + queue_work(tls_strp_wq,
> + &ctx->data_ready_work);
> + break;
> + }
[Severity: Medium]
Can this break return 0 while the next record is still being parsed, with
nothing left to wake nvme-tcp?
data_ready_work is only queued if msg_ready is already set. For the 16th
empty record, tls_rx_rec_done() calls tls_strp_check_rcv(&ctx->strp, false).
If tls_strp_read_sock() returns -ENOMEM, the parse is handed off to
strp->work and msg_ready stays 0:
net/tls/tls_strp.c:tls_strp_check_rcv() {
...
if (tls_strp_read_sock(strp) == -ENOMEM)
queue_work(tls_strp_wq, &strp->work);
...
}
That -ENOMEM can come from alloc_page(sk->sk_allocation) in
tls_strp_read_copy(), and nvme-tcp sets sk_allocation to GFP_ATOMIC. The
copy path runs in copy_mode, or when tls_strp_check_queue_ok() fails on a
fully received record.
Once the loop breaks, tls_strp_msg_ready(ctx) is false and the work item is
not queued. tls_rx_reader_release() calls tls_rx_msg_maybe_announce(),
which also returns early:
if (!READ_ONCE(strp->msg_ready) || strp->msg_announced)
return;
Later, tls_strp_work() parses the record via tls_strp_check_rcv(strp, true).
It announces the record only through ctx->saved_data_ready, which for
nvme-tcp is the pre-handshake callback and not nvme_tcp_data_ready(). The
commit message makes the same point.
nvme_tcp_io_work() sees a 0 result from read_sock and does not requeue
itself. Does the fully received record then sit until another TCP segment
arrives or the I/O times out?
Before this patch, the loop went back into tls_rx_rec_wait(). With
sk_receive_queue non-empty, that retried tls_strp_check_rcv()
synchronously, so this state needed two allocation failures in a row. With
the early break, a single failure is enough.
A related case, with empty records left on ctx->rx_list by MSG_PEEK, can be
reached at this commit. It goes away later in the series, because "tls:
Consume empty data records in tls_sw_recvmsg()" keeps empty records off
rx_list.
> continue;
> }
>
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019-tls-follow-on-v6-0-ab01c4ecca0c%40kernel.org
next prev parent reply other threads:[~2026-10-22 19:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 16:55 [PATCH net-next v6 0/9] net/tls: Receive-path fixes for zero-length data records Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 1/9] tls: Bound consecutive no-data records in tls_sw_read_sock() Chuck Lever
2026-10-22 19:57 ` netdev-bot+sashiko [this message]
2026-10-23 15:15 ` Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 2/9] tls: Check for a pending signal after an empty record Chuck Lever
2026-10-22 19:57 ` netdev-bot+sashiko
2026-10-23 15:18 ` Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 3/9] tls: Honor O_NONBLOCK in tls_sw_splice_read() Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 4/9] tls: Consume empty data records " Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 5/9] tls: Consume empty data records in tls_sw_recvmsg() Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 6/9] tls: Return copied data ahead of a run of empty records Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 7/9] selftests: tls: Skip the zero_len tests when TLS is unavailable Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 8/9] selftests: tls: Extend coverage for zero-length records Chuck Lever
2026-10-22 19:57 ` netdev-bot+sashiko
2026-10-23 15:20 ` Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 9/9] selftests: tls: Cover splice on a nonblocking socket Chuck Lever
2026-10-26 22:37 ` [PATCH net-next v6 0/9] net/tls: Receive-path fixes for zero-length data records Jakub Kicinski
2026-10-27 13:01 ` Chuck Lever
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=179269905526.1189532.975361221217060549@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=cel@kernel.org \
--cc=davejwatson@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=qingfang.deng@linux.dev \
--cc=sd@queasysnail.net \
--cc=shuah@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