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 CD287471267; Tue, 21 Jul 2026 18:16:15 +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=1784657776; cv=none; b=gzuBEM9R/sKhx0lFqtzgUkcT8mtMmtdV5pPGO0ZAJUMLwpRj6n86Rndmh+rXLYLiDEsQhjiAi+5wRREnJ9nX3AbAZGkXyHekYNMlriA/+doYF/xVqGVVIWUhk90a2HLhohjoK6ayb4Yy4Dsi/hIACoZj8eXnzaGdBj6YB7mK38s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784657776; c=relaxed/simple; bh=jnBlzQ3rih9Inw/4t+Zu5W92NtIuDDwBucxs4s083l0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Phj7SAHCkVvTNZTwWmQcehwrttgesQ9iFFsoK5DfVhjguO5VQ1drtv7bLRnmfGBTyZ9gPD1e5cizKkKreeAsGpPqqFk3NFioUejppwv8UxXWpF8mroKeJ313Xmg4KWYvHajkHgpWZYctYn3PBK3S4lJ0hCyCghqj1q3JrfBfPKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Jn5i5+w+; 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="Jn5i5+w+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44FCB1F000E9; Tue, 21 Jul 2026 18:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784657775; bh=OfubUyHqudLQtuzMc3ekGiHn+ceEnWWaajWfWIzVu+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Jn5i5+w+E0r7KuGyVXWZcRQVGw1CVgaDbSHxZGXgMMY1ZHE98w0Zrh5BpnNU82vXc TS0vEtgxrCEpvgBYVOykc77pxsmOh3/V+C9tQXi5VlITbfP66+FrTuNjqEATKmxowC 18/2GhBEiUjDbrmocUYFZBUXjLlsbOCKqySwkSDs= 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.18 0894/1611] ipv6: Fix null-ptr-deref in fib6_nh_mtu_change(). Date: Tue, 21 Jul 2026 17:16:50 +0200 Message-ID: <20260721152535.498748536@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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: 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 b34f6a3e705192..ef66a3c86febbf 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5043,6 +5043,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