From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0B3FA35BDA8 for ; Sat, 15 Aug 2026 06:13:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786774392; cv=none; b=MOgnSCZSwKHzvkDOsKk3np9oNA28vYRhyscxQDFPEMn+aY6RGHZtWPIWPLzCaTjoJlAYyJwOmVwtNdCISCMHfPgmBwtq+uQcfzdW8txFwuP7EOEfsgFSD9a7ou+yRKba1XXpPukPCejpuH3Hu0fvLNjqGjo2d4syuTW3DoV0AnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786774392; c=relaxed/simple; bh=r6mDEl2K/RyN6sem+qpIijRLhc5DWGBoPfUJtnjuNjQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qCBdT2qFIWFB2u0pKLd7//5dSuUogtwTCu1kqA0g/Utpc7tIf3sNPEe7jvAHbpgUCDdznjL7LmGZDAygqY5TkT8tlVeOk6gIr46kyShyWnSBm6DGxeutVBk5Ph3qHmxS8qtzmWW2dNudqTPeuZns3gpbfyBGIu6C+UIG5wS/YlU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=v3+yjsi0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="v3+yjsi0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DC441F000E9; Sat, 15 Aug 2026 06:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786774390; bh=UdxnwvGnRTGrqBJpl1rPe53g+wp9LLoAU7k4D63yxJE=; h=From:To:Cc:Subject:Date:Reply-To; b=v3+yjsi089exiQ4NE+5jGIjzJZsnZVU6ruRmMb6kvzrkB4eKTbwwuQ+G8pc+PvLWf sh+JooubmzLWyMPPNJmQ1dVDBhAEJIpEfRVpMiUCLm/cwN7eHgF5iu+sG74sDyOyk4 zdSJBlri/tusBbmUZTgNnmor9nNBlGQqfcizLUpY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-72139: tcp: defer md5sig_info kfree past RCU grace period in tcp_connect Date: Sat, 15 Aug 2026 15:03:38 +0900 Message-ID: <2026081532-CVE-2026-72139-57f5@gregkh> X-Mailer: git-send-email 2.55.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=5270; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ezmOyW6vSDK8wi2/Up/5JNasc+9fYy8IycKU4UYsKMs=; b=owGbwMvMwCRo6H6F97bub03G02pJDFkNDHtmepyfFfJv450lLJ6Vf2vXGtox/eTQXuXOlVpXW 7og4dD8jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIyiyG+RUNV4ra9Q9xywt5 Lig61rHWz2CyC8OCq+u331ufEr188ynD8ynHpxtdb2U5BgA= 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: tcp: defer md5sig_info kfree past RCU grace period in tcp_connect The md5+ao reconciliation in tcp_connect() (net/ipv4/tcp_output.c) has two symmetric branches: if (needs_md5) { tcp_ao_destroy_sock(sk, false); } else if (needs_ao) { tcp_clear_md5_list(sk); kfree(rcu_replace_pointer(tp->md5sig_info, NULL, ...)); } Both branches free a per-socket auth-info object while the socket is in TCP_SYN_SENT and is already on the inet ehash (inserted by inet_hash_connect() in tcp_v4_connect()). Both branches are reachable by softirq RX-path readers that load the corresponding info pointer via implicit RCU before bh_lock_sock_nested() is taken. The needs_md5 branch is fixed in the prior patch by re-introducing the call_rcu() free in tcp_ao_destroy_sock(): the equivalent per-key loop runs inside tcp_ao_info_free_rcu(), the RCU callback, so by the time it frees each tcp_ao_key all softirq readers that captured the container have already completed rcu_read_unlock(). The needs_ao branch is not symmetric in the same way. The container free can be deferred via kfree_rcu(md5sig, rcu) -- struct tcp_md5sig_info already has the required rcu member (include/net/tcp.h:1999-2002), and the rest of the tree already does this in the tcp_md5sig_info_add() rollback paths (net/ipv4/tcp_ipv4.c:1410, 1436). But the per-key teardown is done by tcp_clear_md5_list() in process context BEFORE the container's RCU grace period: it walks &md5sig->head and frees each tcp_md5sig_key with bare hlist_del + kfree. A concurrent softirq reader in __tcp_md5_do_lookup() / __tcp_md5_do_lookup_exact() (tcp_ipv4.c:1253, 1298) walks the same list via hlist_for_each_entry_rcu() and races with that bare kfree on the keys themselves -- a per-key slab use-after-free of the same class as the TCP-AO bug, on the same race window. Fix this in two halves: 1. Convert the bare kfree() in tcp_connect() to kfree_rcu() so the md5sig_info container joins the rest of the md5sig lifecycle. The local-variable lift is mechanical and required because kfree_rcu() is a macro that expects an lvalue. 2. Make tcp_clear_md5_list() RCU-safe by replacing hlist_del + kfree(key) with hlist_del_rcu + kfree_rcu(key, rcu). struct tcp_md5sig_key already carries the rcu member (include/net/tcp.h:1995) and tcp_md5_do_del() (net/ipv4/tcp_ipv4.c:1456) already uses kfree_rcu, so this restores the lifecycle invariant the rest of the file follows rather than introducing a one-off. The other caller of tcp_clear_md5_list() is tcp_md5_destruct_sock() (net/ipv4/tcp.c:412), which runs from the sock destructor when the socket is already unhashed and unreachable; the extra grace period there is unnecessary but harmless. Making the helper unconditionally RCU-safe is the cleaner contract. The needs_ao branch is not reachable by the userns reproducer used to demonstrate the AO-side splat (the repro installs both keys but ends up in the needs_md5 branch because the connect peer matches the MD5 key, not the AO key); however the symmetric race exists and a maintainer touching this code should not have to think about which branch escapes RCU and which one does not. [also credits to Qihang, who found that this races with tcp-diag] The Linux kernel CVE team has assigned CVE-2026-72139 to this issue. Affected and fixed versions =========================== Issue introduced in 6.18 with commit 51e547e8c89c661f6fbede4a28b1d33b13625683 and fixed in 6.18.40 with commit 33a1bee413628378fd036a4f2b17ba86b0bc560c Issue introduced in 6.18 with commit 51e547e8c89c661f6fbede4a28b1d33b13625683 and fixed in 7.1.5 with commit da48b9bf1eb95a9cfd09d615ca58cfc2b03de369 Issue introduced in 6.18 with commit 51e547e8c89c661f6fbede4a28b1d33b13625683 and fixed in 7.2-rc2 with commit b74cd55038905d5e74c1de109ab78a30b2ea0e1f 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-72139 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/ipv4/tcp_ipv4.c net/ipv4/tcp_output.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/33a1bee413628378fd036a4f2b17ba86b0bc560c https://git.kernel.org/stable/c/da48b9bf1eb95a9cfd09d615ca58cfc2b03de369 https://git.kernel.org/stable/c/b74cd55038905d5e74c1de109ab78a30b2ea0e1f