Skip to contentSkip to conversation

tcp_bpf: propagate error code in tcp_bpf_sendmsg()

PATCH Applied Dmitry Antipov 6 participants 6 messages Oct 19 – Oct 21

Subsystems (5)
Networking Network drivers BPF TCP +1 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tcp_bpf: propagate error code in tcp_bpf_sendmsg()

In tcp_bpf_sendmsg(), the value returned by sk_msg_memcopy_from_iter() is checked for error but not propagated to 'out_err' label, so error handling may not work as expected. Fix this by assigning error value to 'err', thus making sure that error won't be silently ignored.

Fixes 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg")

---
v2: more descriptive commit message

---
 net/ipv4/tcp_bpf.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/tcp_bpf.c +1 -0
index 2e234d155b5e..0ce583f68d3b 100644
@@ -581,6 +581,7 @@ static int tcp_bpf_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 					       copy);
 		if (ret < 0) {
 			sk_msg_trim(sk, msg_tx, osize);
+			err = ret;
 			goto out_err;
 		}
 
Signature · 1 line
2.56.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

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 code inspection). If it was triggered please include the symptoms, like the stack trace or error 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. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

reviewer Reviewed-by on v2 1/1
#2 lore raw
In reply to Dmitry Antipov
Quoted 8 lines · Dmitry Antipov

In tcp_bpf_sendmsg(), the value returned by sk_msg_memcopy_from_iter() is checked for error but not propagated to 'out_err' label, so error handling may not work as expected. Fix this by assigning error value to 'err', thus making sure that error won't be silently ignored.

Fixes 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg")
Reviewed-by on v2 1/1
#3 lore raw
In reply to Dmitry Antipov
Quoted 9 lines · Dmitry Antipov

In tcp_bpf_sendmsg(), the value returned by sk_msg_memcopy_from_iter() is checked for error but not propagated to 'out_err' label, so error handling may not work as expected. Fix this by assigning error value to 'err', thus making sure that error won't be silently ignored.

Fixes 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg")
maintainer Reviewed-by
#4 lore raw
Quoted 8 lines · Jason Xing
Quoted 6 lines · Dmitry Antipov

In tcp_bpf_sendmsg(), the value returned by sk_msg_memcopy_from_iter() is checked for error but not propagated to 'out_err' label, so error handling may not work as expected. Fix this by assigning error value to 'err', thus making sure that error won't be silently ignored.

Quoted 5 lines
Quoted 3 lines
Fixes 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg")
#5 lore raw
In reply to Dmitry Antipov
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 19 Oct 2026 11:22:14 +0300 you wrote:

In tcp_bpf_sendmsg(), the value returned by sk_msg_memcopy_from_iter() is checked for error but not propagated to 'out_err' label, so error handling may not work as expected. Fix this by assigning error value to 'err', thus making sure that error won't be silently ignored.

Fixes 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg")

[...]

Here is the summary with links:
- [v2] tcp_bpf: propagate error code in tcp_bpf_sendmsg()

    https://git.kernel.org/netdev/net/c/82e31923c055

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html