All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v1] tls: fix ring wrap in sk_msg_memcopy_from_iter() after splice
@ 2026-11-20 22:57 Jiayuan Chen
  2026-11-20 23:03 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Jiayuan Chen @ 2026-11-20 22:57 UTC (permalink / raw)
  To: netdev
  Cc: Jiayuan Chen, Eddy Tsalolikhin, Kyle Zeng, John Fastabend,
	Jakub Kicinski, Sabrina Dubroca, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, linux-kernel

tls_sw_sendmsg_splice() forces sg.curr = sg.end after adding the
spliced page.

The following non-splice sk_msg_memcopy_from_iter() is a do-while
loop: it advances i with sk_msg_iter_var_next() and only then tests
i != sg.end, so starting from sg.curr == sg.end it wraps the ring.

Reported-by: Eddy Tsalolikhin <eddsterxyz@gmail.com>
Reported-by: Kyle Zeng <kylebot@openai.com>
Fixes: c5a595000e26 ("net: tls, update curr on splice as well")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
---
 net/tls/tls_sw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 365c9485bb7c..d3a9b1c41de8 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -764,8 +764,10 @@ static int tls_sw_sendmsg_splice(struct sock *sk, struct msghdr *msg,
 		}
 
 		sk_msg_page_add(msg_pl, page, part, off);
-		msg_pl->sg.copybreak = 0;
+		/* keep sg.curr on the last frag so a later copy won't wrap */
 		msg_pl->sg.curr = msg_pl->sg.end;
+		sk_msg_iter_var_prev(msg_pl->sg.curr);
+		msg_pl->sg.copybreak = sk_msg_elem(msg_pl, msg_pl->sg.curr)->length;
 		sk_mem_charge(sk, part);
 		*copied += part;
 		try_to_copy -= part;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v1] tls: fix ring wrap in sk_msg_memcopy_from_iter() after splice
  2026-11-20 22:57 [PATCH net v1] tls: fix ring wrap in sk_msg_memcopy_from_iter() after splice Jiayuan Chen
@ 2026-11-20 23:03 ` netdev-bot+sinfo
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-20 23:03 UTC (permalink / raw)
  To: Jiayuan Chen
  Cc: netdev, Eddy Tsalolikhin, Kyle Zeng, John Fastabend,
	Jakub Kicinski, Sabrina Dubroca, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, linux-kernel

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20 23:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 22:57 [PATCH net v1] tls: fix ring wrap in sk_msg_memcopy_from_iter() after splice Jiayuan Chen
2026-11-20 23:03 ` netdev-bot+sinfo

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.