Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 15DD331A549 for ; Thu, 23 Apr 2026 15:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776957075; cv=none; b=Q1xWQa1kYPTMEilmkGISA2OBCon5R3ZV/wPE0LYaeyvVdmPXmFfInWfoMhp22wd5+Y9g2rR036h9xA1+2mOKNn6DRsYUTEmvPokGEEunVSgEAvS/vJmOKVGR4sgd6y2ETKY6HI2x47lR8BgzEKJYLiyU9hn91qxayP8XVkz1Bc4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776957075; c=relaxed/simple; bh=/j1AJJfDBxsqjmJy1B3m5COuUbT6iX2/gQTqA5uq2c4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n7tBlPNQ4V2bJiS5Aw7XdH1IYyhIxI5h5KDhdaJLnbBP2vJ4/3QgS/M9r/YApBTkoRNDpTCxTL1upOT0JnyIpJao6Y9HN3DWc0wI6COVP4IPbgnn82RbQ3SWJqSe5DVZAnMUBw4mTAVk9zVmeWryaMBoce1uj/aZDpUi8wqOjzc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ptB8yUAq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ptB8yUAq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76674C2BCAF; Thu, 23 Apr 2026 15:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776957074; bh=/j1AJJfDBxsqjmJy1B3m5COuUbT6iX2/gQTqA5uq2c4=; h=From:To:Cc:Subject:Date:Reply-To:From; b=ptB8yUAqgwexJq+mb2F5XOe2xSPXBfwadnxc0PilkHIpSAnZ7beqJg47qpbqyRW3S PtTp/B970lfpDC3bsdJg9TJLETJQEyFy0RQNsATAydmicfVIuGdSyATNKYn+Hk/y+2 xQxUdYCcrUV0fW+zvNPoihs5iDCihklBJzzJqUjc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-31533: net/tls: fix use-after-free in -EBUSY error path of tls_do_encryption Date: Thu, 23 Apr 2026 17:11:10 +0200 Message-ID: <2026042309-CVE-2026-31533-9308@gregkh> X-Mailer: git-send-email 2.54.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4268; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=UHNSEC1DS60TfebBaJ3yRVpoYt/NsaodOC9B4g+VGtA=; b=owGbwMvMwCRo6H6F97bub03G02pJDJmvzHpv90r4Pzt6T/aINUv0uk31XX97nBS/J+0ruxpbv Y3Nc/e9jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjI40iG+eEPrDhOtJ2a8mQN 1+WNs3ZruMh2TmVYsPbvKo93eaWs23sufj1pde/2r+JyQwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: net/tls: fix use-after-free in -EBUSY error path of tls_do_encryption The -EBUSY handling in tls_do_encryption(), introduced by commit 859054147318 ("net: tls: handle backlogging of crypto requests"), has a use-after-free due to double cleanup of encrypt_pending and the scatterlist entry. When crypto_aead_encrypt() returns -EBUSY, the request is enqueued to the cryptd backlog and the async callback tls_encrypt_done() will be invoked upon completion. That callback unconditionally restores the scatterlist entry (sge->offset, sge->length) and decrements ctx->encrypt_pending. However, if tls_encrypt_async_wait() returns an error, the synchronous error path in tls_do_encryption() performs the same cleanup again, double-decrementing encrypt_pending and double-restoring the scatterlist. The double-decrement corrupts the encrypt_pending sentinel (initialized to 1), making tls_encrypt_async_wait() permanently skip the wait for pending async callbacks. A subsequent sendmsg can then free the tls_rec via bpf_exec_tx_verdict() while a cryptd callback is still pending, resulting in a use-after-free when the callback fires on the freed record. Fix this by skipping the synchronous cleanup when the -EBUSY async wait returns an error, since the callback has already handled encrypt_pending and sge restoration. The Linux kernel CVE team has assigned CVE-2026-31533 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15.160 with commit 3ade391adc584f17b5570fd205de3ad029090368 and fixed in 5.15.203 with commit 414fc5e5a5aff776c150f1b86770e0a25a35df3a Issue introduced in 6.1.84 with commit cd1bbca03f3c1d845ce274c0d0a66de8e5929f72 and fixed in 6.1.169 with commit 02f3ecadb23558bbe068e6504118f1b712d4ece0 Issue introduced in 6.6.18 with commit 13eca403876bbea3716e82cdfe6f1e6febb38754 and fixed in 6.6.135 with commit 0e43e0a3c94044acc74b8e0927c27972eb5a59e8 Issue introduced in 6.8 with commit 8590541473188741055d27b955db0777569438e3 and fixed in 6.12.82 with commit aa9facde6c5005205874c37db3fd25799d741baf Issue introduced in 6.8 with commit 8590541473188741055d27b955db0777569438e3 and fixed in 6.18.23 with commit 5d70eb25b41e9b010828cd12818b06a0c3b04412 Issue introduced in 6.8 with commit 8590541473188741055d27b955db0777569438e3 and fixed in 6.19.13 with commit 2694d408b0e595024e0fc1d64ff9db0358580f74 Issue introduced in 6.8 with commit 8590541473188741055d27b955db0777569438e3 and fixed in 7.0 with commit a9b8b18364fffce4c451e6f6fd218fa4ab646705 Issue introduced in 6.7.6 with commit ab6397f072e5097f267abf5cb08a8004e6b17694 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-31533 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/tls/tls_sw.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/414fc5e5a5aff776c150f1b86770e0a25a35df3a https://git.kernel.org/stable/c/02f3ecadb23558bbe068e6504118f1b712d4ece0 https://git.kernel.org/stable/c/0e43e0a3c94044acc74b8e0927c27972eb5a59e8 https://git.kernel.org/stable/c/aa9facde6c5005205874c37db3fd25799d741baf https://git.kernel.org/stable/c/5d70eb25b41e9b010828cd12818b06a0c3b04412 https://git.kernel.org/stable/c/2694d408b0e595024e0fc1d64ff9db0358580f74 https://git.kernel.org/stable/c/a9b8b18364fffce4c451e6f6fd218fa4ab646705