]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tls: don't abort the connection on signal-interrupted sends
authorMaximilian Immanuel Brandtner <maxbr@linux.ibm.com>
Wed, 5 Aug 2026 06:22:48 +0000 (08:22 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 6 Aug 2026 16:38:20 +0000 (09:38 -0700)
When a signal interrupts a blocking send, tls_tx_records() treats the
resulting -ERESTARTSYS as a transmission failure and marks the socket
errored via tls_err_abort() with the raw error code. Later syscalls
return the kernel-internal errno 512 (ERESTARTSYS) to userspace, as the
signal it stems from is no longer pending during syscall exit and thus
never translated.

An interrupted send is not a connection error: the partially sent record
stays queued and is resent later. Interrupt error codes are therefore
excluded from the abort in the same way as -EAGAIN.

Fixes: b341ca51d267 ("tls: Fix tls_sw_sendmsg error handling")
Signed-off-by: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
Link: https://patch.msgid.link/20260805063109.1772314-1-maxbr@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tls/tls_sw.c

index 133ed7c8940284510f2dc571ffd13eaf5dcba4db..62d46736e24b7db3f9401aa11146f3d811e65da4 100644 (file)
@@ -458,7 +458,7 @@ int tls_tx_records(struct sock *sk, int flags)
        }
 
 tx_err:
-       if (rc < 0 && rc != -EAGAIN)
+       if (rc < 0 && rc != -EAGAIN && rc != -EINTR && rc != -ERESTARTSYS)
                tls_err_abort(sk, rc);
 
        return rc;