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 1525B501F4B; Tue, 13 Oct 2026 12:02:29 +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=1791892950; cv=none; b=EPncBhZHxG/l6aNz72MZY8w8H6A5UnlQuWvuq8CDCfbIm0WQSmGdE/HU274OY6Aap/pyeuFdnPuF9dEftdKahDz3NY849r4S0WzOUYgghi0eWfVk9SPXTpFQKh6ejf1pcMUKDrHQUWr6gMLqO6Ta8tf0pPAMQUqasfxQU0d5fIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791892950; c=relaxed/simple; bh=d8T/9drZhi0nRfmp/UQXjsrUp/SIjuPCnkbYDFzpWok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SVpz21E14qzDvlB7R3EKEoWrjhRe+bjX7w+Jlz6ML0Fh+DNqiZcKcVR/kgvp4LzUZFJPBNqkv6VcqbgJs3tDkD5RHV0yqroHePvlJwVRgrTYqR0btg3heyYSMO+lG2qDA7u2ZezUlKagYbSF2tAFfRxB9dMG7mOXfsQ7Q5PTt3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H2ilguWc; 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="H2ilguWc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD3E1F0089A; Tue, 13 Oct 2026 12:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791892949; bh=Aoy5hy2SdR8Tbp5UwXyahlNPLqF5x2T93+ahzulF+Ms=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H2ilguWcDcWH+rq439+0gA/Yvd9dOfRi/sBVqyxCYZJwN83kn5gO/qQur/H/i8QDq Y+EhhpkCxOBhh3KDA3ZFjLyxAHm5q4Wq3gBZBf3/iO7Lr/wPDj7blNo5iyEOvI1fWw drjp99vQzAVUHhXmNxEKGdIqiWJxp0rrCy6ze/wM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daehyeon Ko <4ncienth@gmail.com>, Ido Schimmel , Jakub Kicinski Subject: [PATCH 6.18 018/621] ipv4: stop PMTU walk when nexthop group shrinks Date: Tue, 13 Oct 2026 13:30:13 +0200 Message-ID: <20261013112921.296972845@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112920.855194808@linuxfoundation.org> References: <20261013112920.855194808@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daehyeon Ko <4ncienth@gmail.com> commit 6619e01855e65ef35723685a557e3eb106f4ecf5 upstream. Commit 7d3f3b4367f3 ("net: ipv4: Cache pmtu for all packet paths if multipath enabled") made __ip_rt_update_pmtu() update every path. For nexthop objects, fib_info_num_path() and fib_info_nhc() independently load nh->nh_grp. RCU protects each group's lifetime but does not make the loads observe the same group. If replacement shrinks the group after the loop accepts an index, fib_info_nhc() returns NULL and update_or_create_fnhe() dereferences it. A deterministic probe only widened the existing window between the real operations. On v7.2, an RTM_NEWNEXTHOP replacement published a one-member group after the PMTU reader accepted index 1 from a two-member group, producing: KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: update_or_create_fnhe+0x45/0x15b0 Stop when the indexed path is absent. Groups are dense, so no later index exists in that snapshot. The same real-writer window completed 114,423 PMTU iterations without an oops with this check. A reproducer is available on request. Replacement requires CAP_NET_ADMIN in the network namespace. Where unprivileged user namespaces are permitted, a local user can obtain it in a new user and network namespace. Fixes: 7d3f3b4367f3 ("net: ipv4: Cache pmtu for all packet paths if multipath enabled") Cc: stable@vger.kernel.org Signed-off-by: Daehyeon Ko <4ncienth@gmail.com> Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/4fb87ed994dfc067178fc845cdd8bc9b5446b039.1790915964.git.4ncienth@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/route.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1080,6 +1080,8 @@ static void __ip_rt_update_pmtu(struct r for (nhsel = 0; nhsel < fib_info_num_path(res.fi); nhsel++) { nhc = fib_info_nhc(res.fi, nhsel); + if (!nhc) + break; update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock, jiffies + net->ipv4.ip_rt_mtu_expires); }