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 A778935C6AD; Tue, 21 Jul 2026 21:33: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=1784669611; cv=none; b=WHLgrN+Fx9xFxNsnJyIf5sigT7+6UcfvvwgqYw+U/ui3f5xHI0v3RzmfrfdhN4O8q7GNGKR7a5m+BE/kVgOyi3I/W23LGzjnIPQRKou3lCsii37fY+KdW7Z+YOy7t9lM5Yw3EW/Z3UCIJjp4PyDQ0xV3A7twq2u9bCUYPlFzvOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784669611; c=relaxed/simple; bh=VsJ0edT/HUREC8004IhIz5TDpYBD9f9O1tzhWzWHms4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SpfvDL9lTyRxaab924e5rfUQxlFV2bEGQc/uUDuN6X4ce2n8Wnor++oAHfXCtPNROiZ98LBsitBzIg5SNsz7BbC4BRCaGWrsGjv1CVq6lCaAb8VeCxt9U91ARlsOGa2JtmNpy+/7qEEwXHZ4sJUrbi1dcnX0K65rKHxjvNzpZgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tfJegN9m; 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="tfJegN9m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C56851F00A3A; Tue, 21 Jul 2026 21:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784669608; bh=f1oxYsiZNe0u39I/Kt1kZLwegu/PY1vW+qX2CEayrow=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tfJegN9mJ9rxUGhcKRgoSVkqhU4XYWojtf099CkZwQZC2CJwGNopJyuguf07r3edL EVxQwy5Pa98qyDNIBSgUNIyI5Pst7qisGwarSSSctLr3Cw0bMQ3B0kV9xlrFZ3qOBO Ow3s9njrvqQ8YA+xJG0JlwGJpX7EPE57tz+PIxzo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Weiming Shi , Xiang Mei , Fernando Fernandez Mancera , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 0620/1067] ipv6: Fix null-ptr-deref in fib6_nh_mtu_change(). Date: Tue, 21 Jul 2026 17:20:21 +0200 Message-ID: <20260721152438.469728261@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiang Mei [ Upstream commit 46c3b8191aad3d032776bf3bebf03efdf5f4b905 ] fib6_nh_mtu_change() re-fetches idev via __in6_dev_get(arg->dev) and dereferences idev->cnf.mtu6 without a NULL check. addrconf_ifdown() clears dev->ip6_ptr with RCU_INIT_POINTER() after rt6_disable_ip() has released tb6_lock, so the RA-driven MTU walk can observe a NULL idev and oops. The caller rt6_mtu_change_route() guards its own __in6_dev_get(), but this re-fetch is unguarded; nexthop-backed routes survive addrconf_ifdown()'s flush, so the walk still reaches it after ip6_ptr is nulled. Return 0 when idev is NULL, matching rt6_mtu_change_route() and the fib6_mtu() fix in commit 5ad509c1fdad ("ipv6: Fix null-ptr-deref in fib6_mtu()."). Oops: general protection fault, ... KASAN: null-ptr-deref in range [0x00000000000002a8-0x00000000000002af] RIP: 0010:fib6_nh_mtu_change+0x203/0x990 rt6_mtu_change_route+0x141/0x1d0 __fib6_clean_all+0xd0/0x160 rt6_mtu_change+0xb4/0x100 ndisc_router_discovery+0x24b5/0x2cb0 icmpv6_rcv+0x12e9/0x1710 ipv6_rcv+0x39b/0x410 Fixes: c0b220cf7d80 ("ipv6: Refactor exception functions") Reported-by: Weiming Shi Signed-off-by: Xiang Mei Reviewed-by: Fernando Fernandez Mancera Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260619045334.2427073-1-xmei5@asu.edu Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/route.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index dde86722cc0399..f047000e2c55ce 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4973,6 +4973,9 @@ static int fib6_nh_mtu_change(struct fib6_nh *nh, void *_arg) struct inet6_dev *idev = __in6_dev_get(arg->dev); u32 mtu = f6i->fib6_pmtu; + if (!idev) + return 0; + if (mtu >= arg->mtu || (mtu < arg->mtu && mtu == idev->cnf.mtu6)) fib6_metric_set(f6i, RTAX_MTU, arg->mtu); -- 2.53.0