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 079CD3E0222; Mon, 13 Apr 2026 14:46:40 +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=1776091600; cv=none; b=oI3Fx3CgnnAipF5XTt7BupM/9EyrP0SpbOF/JUHDCucq79RO2mf0dG4/ywQDOoFK5alMUbVyliEpkUUgdnJmq5Li9hB+6MD9vRACiynF/uYkPa16oF9rmZy5LzeqAApNywuoxJ1PerLlXdqEjuNd3WJipTruwqDj0dMPG19C48U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776091600; c=relaxed/simple; bh=bhACCNWwYGbbsioUZ9lwrnNsFznu/fKcqluHk8miblo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AUSH1vLUhznlBS0iReXz2dTqBFjdOXPiw8tLmrJg1XEH0cow18umecsy5ImyO0P9B8jN84dnXl3DykDdYbZfplrCKs2ZJ1XCYHx9dUYsp8hbYLnAUiWR62bcBskHiyONg5+7fhoqpf+FHv2cetVXHVtwQWo8gNT8kpyLEr8wLRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IQycd2Y3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IQycd2Y3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E351C2BCAF; Mon, 13 Apr 2026 14:46:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776091599; bh=bhACCNWwYGbbsioUZ9lwrnNsFznu/fKcqluHk8miblo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=IQycd2Y3MOzE++hOSt40w85Jk5ozySGjdZeYUcuPg2afcoGAftYeQ3QsqHKr7jZi+ V6l/EOLDK/DIUXhTtAGniEckjBQUOASnfRHTCuoKHJ0V9LsfzWNhGly5ax+yfM6St4 7EY/Xz8XOd5ABoNq+GY5/1U0RpvA3ELODwj0Wj+b94O27e2yFRHaOVFnfEP0KCHaYn zpUiehOGzBHFUXvkHKcIDluzDJMUtnMyCc2+mQZOTcOkvGSPn/L5EqiFZ0Bd4R1cfq QwMhhAbuF5hhwrID9wfWs8YvCk1pKkTHGL3TwI1C5LZ71bYY82iUjC0n4YG3WV+W8u X/5wDSDkJv5Yg== Message-ID: <88046eb3-603c-4296-9a9f-616a6f37c610@kernel.org> Date: Mon, 13 Apr 2026 08:46:38 -0600 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v1 1/2] nexthop: fix IPv6 route referencing IPv4 nexthop Content-Language: en-US To: Jiayuan Chen , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20260413114522.147784-1-jiayuan.chen@linux.dev> From: David Ahern In-Reply-To: <20260413114522.147784-1-jiayuan.chen@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/13/26 5:45 AM, Jiayuan Chen wrote: > syzbot reported a panic [1] [2]. > > When an IPv6 nexthop is replaced with an IPv4 nexthop, the has_v4 flag > of all groups containing this nexthop is not updated. This is because > nh_group_v4_update is only called when replacing AF_INET to AF_INET6, > but the reverse direction (AF_INET6 to AF_INET) is missed. > > This allows a stale has_v4=false to bypass fib6_check_nexthop, causing > IPv6 routes to be attached to groups that effectively contain only AF_INET > members. Subsequent route lookups then call nexthop_fib6_nh() which > returns NULL for the AF_INET member, leading to a NULL pointer > dereference. > > Fix by calling nh_group_v4_update whenever the family changes, not just > AF_INET to AF_INET6. > > Reproducer: > # AF_INET6 blackhole > ip -6 nexthop add id 1 blackhole > # group with has_v4=false > ip nexthop add id 100 group 1 > # replace with AF_INET (no -6), has_v4 stays false > ip nexthop replace id 1 blackhole > # pass stale has_v4 check > ip -6 route add 2001:db8::/64 nhid 100 > # panic > ping -6 2001:db8::1 > > [1] https://syzkaller.appspot.com/bug?id=e17283eb2f8dcf3dd9b47fe6f67a95f71faadad0 > [2] https://syzkaller.appspot.com/bug?id=8699b6ae54c9f35837d925686208402949e12ef3 > Fixes: 7bf4796dd099 ("nexthops: add support for replace") > Signed-off-by: Jiayuan Chen > --- > net/ipv4/nexthop.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: David Ahern