Article View: linux.kernel.netdev
Article #4780[PATCH v2] tcp_bpf: propagate error code in tcp_bpf_sendmsg()
From: Dmitry Antipov
Date: Mon, 19 Oct 2026 08:22
Date: Mon, 19 Oct 2026 08:22
29 lines
6562 bytes
6562 bytes
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 <shodan.ai@mcst.ru>
Fixes: 5153a75ef34b ("tcp_bpf: Fix copied value in tcp_bpf_sendmsg")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v2: more descriptive commit message
---
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;
}
--
2.56.0
Technical Details
Message-ID:
<20261019082214.102398-1-dmantipov@yandex.ru>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348338-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348338-linux-kernel-netdev=dewy.ru From: dmantipov@yandex.ru (Dmitry Antipov) Newsgroups: linux.kernel.netdev Subject: [PATCH v2] tcp_bpf: propagate error code in tcp_bpf_sendmsg() Date: Mon, 19 Oct 2026 11:22:14 +0300 Organization: Usenet Network Message-ID: <20261019082214.102398-1-dmantipov@yandex.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3544325"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:9k8esc2UPqaoBBttyXArQLlTp9Q= sha256:ACU6p3Fm0/tnFq+GArGHSzULeoOsTJkVJ3s6QUXLMc8= sha1:gTMbwQioK9MGvXRAJWsuSxHQ7AQ= sha256:ARnzLfJv33dgKDExv4amIaKt4sEGsQQT92Wo4tvMSx8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 16AEE110947; Mon, 19 Oct 2026 11:27:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.048 X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=yandex.ru X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lm-COTeGV2nj; Mon, 19 Oct 2026 11:26:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348338-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=yandex.ru X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 66177110934; Mon, 19 Oct 2026 11:26:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 2A00C25255; Mon, 19 Oct 2026 08:22:25 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D84C455629; Mon, 19 Oct 2026 08:22:24 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="nTZA2JpV" X-Received: from forward101d.mail.yandex.net (forward101d.mail.yandex.net [51.250.60.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A7F139099C; Mon, 19 Oct 2026 08:22:19 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.250.60.161 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792398144; cv=none; b=ubarJ3vjzLqdZUn1gXBBPMNVAYG2hQq26SUvHPONQqSPspJa0aPDJgFdGx9kUGh20vVfpswv/xLqbwnaAaqWvYf418l/PqAemK1BUGxRTyrFavvFnCc+uAdI1a8RNIoFCWVlzPPbheoiqDWu7BPzvKpI1X6atpRu2CUrRiKjUP8= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792398144; c=relaxed/simple; bh=wNGjvvDOkUEQLTcMKCYG8jQ1uAuLjJifJ1f5viyc1HU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Lhbm/LDeZiHq6oPAQo7n5fXWfa4+tTuQlzYXes7JlW6hBRcqF9IScE0sJVLxAttTKvvrIpxosFFQEB9MD4L6uCx0wVns27+AN8UYyQOG6UNX2VOki3ns/lk1NY3wRzXePqVhqPCIhAciSlKldJIg/qDGnUhrqAMIEL6qUGSGp28= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=nTZA2JpV; arc=none smtp.client-ip=51.250.60.161 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru X-Received: from mail-nwsmtp-smtp-production-main-80.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-80.yp-c.yandex.net) by forward101d.mail.yandex.net (postfix) with ESMTPS id 5979DC00C0; Mon, 19 Oct 2026 11:22:17 +0300 (MSK) X-Received: by mail-nwsmtp-smtp-production-main-80 with ESMTPSA id FMUh5QXdISw0-fSJhSDdh; Mon, 19 Oct 2026 11:22:16 +0300 X-Yandex-Fwd: 1 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1792398136; bh=UwurFYGWjQXk7l+9kKaGrj3yOkB2j+2Uzg794igvGr4=; h=Message-ID:Date:Cc:Subject:To:From; b=nTZA2JpVk15t6zRlt+WyZ/+qKxuPOb5/X86ZGsBhnGUiX23IJKt9lyjPa8uxrd62l J7NABKOTZ3Z973TlF51T+vFxHA90FakIdri1Usz3E0OyaOXg7lD8cp2N7Fx24ubwvW Mja5LWNHPGyOMq9k0U3csIpPr01CMhoQUvBuqfco= X-Authentication-Results: mail-nwsmtp-smtp-production-main-80; dkim=pass header.i=@yandex.ru X-Cc: Denis Yarapov <yarapov_d@mcst.ru>, netdev@vger.kernel.org, bpf@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov <dmantipov@yandex.ru>, Sashiko <shodan.ai@mcst.ru> X-Mailer: git-send-email 2.56.0 X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>