From mboxrd@z Thu Jan 1 00:00:00 1970 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 EA1833BA254; Mon, 23 Mar 2026 16:13:54 +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=1774282435; cv=none; b=oI8BWuYSS/g8yZup7ExOJNAxsHLeIU8W1bxm5upjpn3IqhcdDxtoBHqe7PzAcVc0Ib4gg8CWKOGEIFbqV5UROG49kFfcrb8nNrUrOMBm3D85MFm001GHY7CmRCe/Z0w2L7Px0E/d5NUeXmCVuN6uKz4FKB1IgkCiVCDnREB3z84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282435; c=relaxed/simple; bh=W3wsA/TTyzQWjhbw9YSIvGyS61xzMeADjLO0mvMQGHo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rax9KNoBXk5nd+IMHyAb0AEmlhXwI/cAlPEJJ5c5ry9zQr1Vo4TWio8cyPE/G//H1PORuC6od7KOpr86O8+LionTd94e8RYoCTzcKM3OWTPDvWU8CFOIcEcJZGw7aRDL4nLLU5BSX6i2tdYOH8F3MmJL1IHaDK1ds04fjOeTlxU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ItaBFuwC; 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="ItaBFuwC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E29C4CEF7; Mon, 23 Mar 2026 16:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774282434; bh=W3wsA/TTyzQWjhbw9YSIvGyS61xzMeADjLO0mvMQGHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ItaBFuwCtMH7GFvxT4f9O6kfiv51ThOspytepyzHNVXRCjtGS9z7SNtT0EIOQuYcT xmvz1uoAgJP41N4CwxqBaqPIduhZQSyrX57PLIga8rnrXs2DiVdfUsk474iO/FYTt0 BcQ+cgpDw1J/f3LrGvxHtHodVsE4lGl6/dbalN04= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fernando Fernandez Mancera , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 138/481] net: vxlan: fix nd_tbl NULL dereference when IPv6 is disabled Date: Mon, 23 Mar 2026 14:42:00 +0100 Message-ID: <20260323134528.624153300@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Fernando Fernandez Mancera [ Upstream commit 168ff39e4758897d2eee4756977d036d52884c7e ] When booting with the 'ipv6.disable=1' parameter, the nd_tbl is never initialized because inet6_init() exits before ndisc_init() is called which initializes it. If an IPv6 packet is injected into the interface, route_shortcircuit() is called and a NULL pointer dereference happens on neigh_lookup(). BUG: kernel NULL pointer dereference, address: 0000000000000380 Oops: Oops: 0000 [#1] SMP NOPTI [...] RIP: 0010:neigh_lookup+0x20/0x270 [...] Call Trace: vxlan_xmit+0x638/0x1ef0 [vxlan] dev_hard_start_xmit+0x9e/0x2e0 __dev_queue_xmit+0xbee/0x14e0 packet_sendmsg+0x116f/0x1930 __sys_sendto+0x1f5/0x200 __x64_sys_sendto+0x24/0x30 do_syscall_64+0x12f/0x1590 entry_SYSCALL_64_after_hwframe+0x76/0x7e Fix this by adding an early check on route_shortcircuit() when protocol is ETH_P_IPV6. Note that ipv6_mod_enabled() cannot be used here because VXLAN can be built-in even when IPv6 is built as a module. Fixes: e15a00aafa4b ("vxlan: add ipv6 route short circuit support") Signed-off-by: Fernando Fernandez Mancera Link: https://patch.msgid.link/20260304120357.9778-2-fmancera@suse.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/vxlan/vxlan_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 50dacdc1b6a7a..9c3a12feb25d2 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -2171,6 +2171,11 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) { struct ipv6hdr *pip6; + /* check if nd_tbl is not initiliazed due to + * ipv6.disable=1 set during boot + */ + if (!ipv6_stub->nd_tbl) + return false; if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) return false; pip6 = ipv6_hdr(skb); -- 2.51.0