mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Slavin Liu <bolin.liu@seu.edu.cn>
Cc: dsahern@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC net] icmp: skip IPv6 probe lookup when IPv6 is disabled
Date: Tue, 15 Sep 2026 19:16:26 +0300	[thread overview]
Message-ID: <20260915161626.GA765683@shredder> (raw)
In-Reply-To: <20260911060925.94441-1-bolin.liu@seu.edu.cn>

On Fri, Sep 11, 2026 at 02:09:25PM +0800, Slavin Liu wrote:
> With CONFIG_IPV6=y and ipv6.disable=1, inet6_init() skips address
> configuration, leaving inet6_addr_lst unallocated. An enabled IPv4
> extended-echo probe can still request an IPv6 address lookup.
> 
> Check ipv6_mod_enabled() before the lookup so the existing no-interface
> reply handles this case. This fixes the new lookup-internal NULL access;
> it is not a patch for the removed IPv6 stub ERR_PTR sink.

I don't understand what the last sentence means.

> 
> Detected by static analysis and reviewed with AI-assisted source auditing.
> 
> Fixes: d98adfbdd5c0 ("ipv4: drop ipv6_stub usage and use direct function calls")
> Assisted-by: LLM
> Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
> ---
>  net/ipv4/icmp.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> index 0caedfc7ca92..d8683b0151b7 100644
> --- a/net/ipv4/icmp.c
> +++ b/net/ipv4/icmp.c
> @@ -1360,6 +1360,8 @@ bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr)
>  		case ICMP_AFI_IP6:
>  			if (iio->ident.addr.ctype3_hdr.addrlen != sizeof(struct in6_addr))
>  				goto send_mal_query;
> +			if (!ipv6_mod_enabled())

Moving this to ipv6_dev_find() would be consistent with other exported
functions that already have the check like ip6_fragment() and
ip6_dst_lookup_flow().

FTR, I wasn't aware that an IPv4 Extended Echo Request can identify a
probed interface by an IPv6 address, but RFC 8335 allows it:

"If the Interface Identification Object identifies the probed interface
by address, that address can be a member of any address family.  For
example, an ICMPv4 Extended Echo Request message can carry an Interface
Identification Object that identifies the probed interface by IPv4,
IPv6, or IEEE 802 address.  Likewise, an ICMPv6 Extended Echo Request
message can carry an Interface Identification Object that identifies the
probed interface by IPv4, IPv6, or IEEE 802 address."

> +				break;
>  			dev = ipv6_dev_find(net, &iio->ident.addr.ip_addr.ipv6_addr, dev);
>  			dev_hold(dev);
>  			break;

      reply	other threads:[~2026-09-15 16:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  6:09 Slavin Liu
2026-09-15 16:16 ` Ido Schimmel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915161626.GA765683@shredder \
    --to=idosch@nvidia.com \
    --cc=bolin.liu@seu.edu.cn \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®