Article View: linux.kernel.netdev
Article #5023[PATCH net-next v6 6/9] tls: Return copied data ahead of a run of empty records
From: Chuck Lever
Date: Mon, 19 Oct 2026 16:55
Date: Mon, 19 Oct 2026 16:55
41 lines
10338 bytes
10338 bytes
Once tls_sw_recvmsg() has copied enough data to meet the receive
low-water mark, the receive loop continues only while another
record is ready. A zero-length application_data record is consumed
without advancing len, so a peer that follows data with a stream of
empty records keeps the reader in the loop. The reader does not get
the data already copied until the stream stops or a signal is
pending. The delay has not been reproduced.
Leave the receive loop at an empty record once the low-water mark
is met. A reader that has copied nothing still reads empty records
for as long as they arrive.
Fixes: 04b25a5411f9 ("net/tls: fix no wakeup on partial reads")
Suggested-by: sashiko-bot <netdev-bot+sashiko@kernel.org>
Link: https://lore.kernel.org/r/179124254665.434549.12245680127262431659@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
---
net/tls/tls_sw.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 550308410ff1..599bf1f21189 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1933,6 +1933,12 @@ int tls_sw_recvmsg(struct sock *sk,
/* An empty record still marks a boundary. */
msg->msg_flags |= MSG_EOR;
+ /* Return data already copied instead of holding it
+ * through a run of empty records.
+ */
+ if (decrypted + copied >= target)
+ break;
+
/* A run of empty records advances neither loop bound,
* and tls_rx_rec_wait() tests for a signal only after
* sleeping.
--
2.55.0
Technical Details
Message-ID:
<20261019-tls-follow-on-v6-6-ab01c4ecca0c@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348721-linux-kernel-netdev=dewy.ruReferences:
<20261019-tls-follow-on-v6-0-ab01c4ecca0c@kernel.org>Show 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-348721-linux-kernel-netdev=dewy.ru From: cel@kernel.org (Chuck Lever) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v6 6/9] tls: Return copied data ahead of a run of empty records Date: Mon, 19 Oct 2026 12:55:22 -0400 Organization: Usenet Network Message-ID: <20261019-tls-follow-on-v6-6-ab01c4ecca0c@kernel.org> References: <20261019-tls-follow-on-v6-0-ab01c4ecca0c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3666494"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:U+Nzk6d/vZs3NHQdKzg2ur28CP4= sha256:d4WKB3cS7gVSeywS3F0BIDR179ghXO/P9bxjmkh86Hc= sha1:hmxTazyY67QC0V2082wPyQHE450= sha256:UPmeHxivyuysz7UjR3pbVeEeOK+lJJcnp2ZNO0vbABU= 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 8D4EB110A81; Mon, 19 Oct 2026 20:32:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.729 X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 xV9HLqlcXuMx; Mon, 19 Oct 2026 20:32:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348721-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 1AF15110A7E; Mon, 19 Oct 2026 20:32:35 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 7D987101107; Mon, 19 Oct 2026 16:55:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792428941; b=3BwxZu6/5Ir0xkYcjaJ2Z+QsT/4bIB5R1Repc1fXITailA2GQr20MCMwayjIB68ToN+O Nk+AT/xfI6VAbfSBNesGMMnOJK4GiaumKk1TqsQ933Do4xD1tGxFEXKjJU/TF90JOJjrM 6RebWKg24CY8PYorPjX+RJoU+/bxPxG4cbPssfuqsMPay6n72tdpzDRiav7MNtMKfp1rO uBaPKWwyELj/aYuC7PqKomTKUZmpk3HEEjKIHC91TcPCXzmZDMFbVT2fGJmGD+/O7h8nN DI8TlRDhIsobGcjK11etgDUD7Yz6hW41fGMqbQybPeipVzp/RCj+oLbcrvkzFzUwwIg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792428941; h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=dhKiNbMxx5wK3WqJKJtEBmeHBf3k9RLE0GuJwhoWhPs=; b=r+oeQ4Q/pqJ0vL2iwc3I2cRHM4h7+qEpMe7joazqRUMrUYUM1Zp2L3u4ARWLdUF3vw7n l5Rnk+jBMvwr3Bs4yj3e/fdSOPDCQY7GhhGP62qfCNbFxGw8g/8hL53//3S4s70QyOrGZ /KS9ur4TMv4AK4yT1v0x4Rae6GTqwgbLyC/Tpl4C9LKmPvO58z8M9ZS5mCYVH9J+zGgzP atCiQntyydzPtRQtZjt/I0UbaPsYEUHOjqsPzUKVWHIoCY79BL/lLU7gFbt0aG3N2+I0i N5LFovyy7yy55iXkrFB+B41ZiCy48rKJP8RoVyLjWom8sd3KKfkGRQIiniysBPEhniw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mXO0TgRx; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0FEA60A2618; Mon, 19 Oct 2026 16:55:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mXO0TgRx X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792428940; b=VVrrWFiLecQ6OekREIQ/05mkDkivJpdWIge1NibBlYKDVDfIpgUOv0JUZ/tkxc6zpgO9 2FhdswbWZDrcizyUowo3Hb1GKsjTqqIV22q0u1ptGC7nL7meWJeYm4UzP0gMTvnUTgFiM uIigjJ6dnDRKFgxL/S/5ZjQK5xAqUO/bzSIM9ft1hxkblukbjQv7eoTzBd0trbJYc4X2L yRkXrsFIdMdaoSEvEJjiUvkflgbKr5juueHAzjvciUsWQHoWciwQlGfc8e8qzKY76NkZY pouFEBDXV+bAcb+IVcJSFf5yIb6KbRO/f7BPNGGLLNnDENi7+/6xsxH48miBDrjb42A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792428940; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=dhKiNbMxx5wK3WqJKJtEBmeHBf3k9RLE0GuJwhoWhPs=; b=odb5y3M//mWUU3PK0iyqbj5zKHodlj0GdvD+SjWWkLFe/lsnKUvMypxaaLrg2aV18JcK swPunTzXUsk5NI7WhD/QDPeWrnIYCRY71Odrw25gpUmM3+kO/btwZx5Ec+mWzDcR03bU/ S1ck4al1SN0Rx9ZZqBqVT5t8MT54LWRtBtpYHiSQwAOP1oVfoDYTHLL+rVPM6oztYpmqg Zu0J/6CvpYp64lXLRYvNzWZMosuVEvzBK0DkvOCSl0t7v00rNgCl0Y2CIB+8OoNQRnvH8 ZxkcEMxnYqqoB8NMHCbPs5dbPaEmpLs2qkDsuB27zG0f6JelIfsXEgc04OTNLsPHz7g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mXO0TgRx; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C855A60A2611; Mon, 19 Oct 2026 16:55:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A9211F000CA; Mon, 19 Oct 2026 16:55:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792428939; bh=dhKiNbMxx5wK3WqJKJtEBmeHBf3k9RLE0GuJwhoWhPs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=mXO0TgRx/7WZb+ugIIuBHf5+sjsKtkIlXt69s6rlRC9ifdCrFUIDSEMDHDep4DsTm 87bhYxG3da6GUOu0FmjZDbuQJKGp+N7h0XJ3t9b/C3+8G0BgBUAZP16Rjf4sT6m1rz XZI5eHmAAcrqMZxY8mTS+LbIc3Ni1AWVqBuXFNnLS776j/mOK0dyCZrIUnL4nBDMTD BcdeqtYspUwEQf7ywI99eM9jgag99olY5iSxdEKQQKeK4fm3OnKSKxj/sgLbAmm2Xn DESbN/jX3k5IbrJ1fcanL52JaC/87P2ly779v5l5pQ+B9itU7K4sXY8TBWW5RrGwoF oKhPBJdbTIG1g== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261019-tls-follow-on-v6-0-ab01c4ecca0c@kernel.org> X-Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, sashiko-bot <netdev-bot+sashiko@kernel.org> X-Mailer: b4 0.17-dev-9c833 X-Developer-Signature: v=1; a=openpgp-sha256; l=1535; i=cel@kernel.org; h=from:subject:message-id; bh=n7V7hlsDvN4gCTzeIS6j/jVYkcSRP0feMdAlwpShcLE=; b=owEBbQKS/ZANAwAKATNqszNvZn+XAcsmYgBq1kuBpVlgWkZCl+DSneQLnRracm+5jcyGQJDri tCpTfbt7zSJAjMEAAEKAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCatZLgQAKCRAzarMzb2Z/ l1m0D/99lwo6qVi1jC6HG+lPp69aNEutPRiFqAvkGf+uiSKun2M92Is33ZlrYWvNecFDbIXx4Xy FLvSFSHSsnDtxhBpnXjGA7nAPAHsZG5wdAdT7EqA9upQP6c0wcurR5R8uRYSG3Zf7g/NwiAIZMi Khv+HbRDSq1Ipxb2HhZ/ZfcX4gDUMydZIPCPea5Mo81aPgFyTV4EgA7TM61QMlAGYr7RQNYtW/M qn+06UkQlrUPMDE47sgUzHjjZnxjHegtabtLsy2Y/zL1eluRHG/a0HdEkRJRc/bsZ1c70ZHHn7Z bntAnZ5c29t1n9sUy5DZKauvVfov7p+uCiiX5SUD2VXeJnSKBKtznX5R6P5MtcgLRY9w2HjnMbD AGhl6BR1kUcOknxJVnIvOhBpiB/qkk4JF6rYN/JJSgo9z6kEmKmiyft2EbO8UIoMGnQMQq3pRAI XG9IAWiuzwQ8lLUrF0QjC2oh0gG63go9Gz7pKIFptoAmSiWVdauMeSLLuIemZ0veYgLWA0msVx0 JIKKFIR9blq7NgpSOt/UPb2ippBKxETmd8iJlpldtW817kvEHU1MhucbqOFZePpAEkqFSTOfh+6 A+9BcegRq4FlsPFdKuQ4t4f09jzN70pMZwEMLLHAokyKUs63JjJmVGE5ebCXkZObp+udWeP4Pnk a6F8cjUY+oLWm5g== X-Developer-Key: i=cel@kernel.org; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97