From 82e31923c0553fdbfcddcd910ca07952880ca9b9 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 19 Oct 2026 11:22:14 +0300 Subject: [PATCH] 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. Reported-by: Sashiko Fixes: 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg") Signed-off-by: Dmitry Antipov Reviewed-by: Kuniyuki Iwashima Reviewed-by: Jason Xing Reviewed-by: Eric Dumazet Link: https://patch.msgid.link/20261019082214.102398-1-dmantipov@yandex.ru Signed-off-by: Jakub Kicinski --- net/ipv4/tcp_bpf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 2e234d155b5e..0ce583f68d3b 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -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; }