Commit 2fef0e86 authored by Jiayuan Chen's avatar Jiayuan Chen Committed by Greg Kroah-Hartman
Browse files

ktls, sockmap: Fix missing uncharge operation



[ Upstream commit 79f0c39a ]

When we specify apply_bytes, we divide the msg into multiple segments,
each with a length of 'send', and every time we send this part of the data
using tcp_bpf_sendmsg_redir(), we use sk_msg_return_zero() to uncharge the
memory of the specified 'send' size.

However, if the first segment of data fails to send, for example, the
peer's buffer is full, we need to release all of the msg. When releasing
the msg, we haven't uncharged the memory of the subsequent segments.

This modification does not make significant logical changes, but only
fills in the missing uncharge places.

This issue has existed all along, until it was exposed after we added the
apply test in test_sockmap:
commit 3448ad23 ("selftests/bpf: Add apply_bytes test to test_txmsg_redir_wait_sndmem in test_sockmap")

Fixes: d3b18ad3 ("tls: add bpf support to sk_msg handling")
Reported-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Closes: https://lore.kernel.org/bpf/aAmIi0vlycHtbXeb@pop-os.localdomain/T/#t


Signed-off-by: default avatarJiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Reviewed-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Link: https://lore.kernel.org/r/20250425060015.6968-2-jiayuan.chen@linux.dev


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 54ce9bcd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment