Linux Documentation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: vjardin@free.fr
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, donald.hunter@gmail.com,
	nicolas.dichtel@6wind.com, horms@kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	shuah@kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next 1/5] lisp: add LISP (Locator/ID Separation Protocol)
Date: Fri, 27 Nov 2026 22:25:48 +0000	[thread overview]
Message-ID: <179581834896.3135.15923750690737278293@kernel.org> (raw)
In-Reply-To: <20261126-for-upstream-lisp-v1-v1-1-7382a4bcfd9b@free.fr>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] lisp_stop() unlinks a non-collect_md device's node from its
  socket's IID hash chain with hlist_del_rcu() (lisp.c:414) and returns…
- [Low] drivers/net/lisp.c does not build or link when CONFIG_IPV6=n.

--

lisp: add LISP (Locator/ID Separation Protocol)

This adds a LISP (RFC 9300) data plane tunnel device. It encapsulates IPv4
and IPv6 packets in a LISP header over UDP port 4341. The RLOC of each
packet comes from the lightweight tunnel metadata of its route or nexthop,
and the kernel keeps no map-cache.

> diff --git a/drivers/net/lisp.c b/drivers/net/lisp.c
> new file mode 100644
> index 0000000000000..8f5a79c88b2c1
> --- /dev/null
> +++ b/drivers/net/lisp.c
> @@ -0,0 +1,1033 @@

[ ... ]

> +static int lisp_stop(struct net_device *dev)
> +{
> +	struct lisp_dev *lisp = netdev_priv(dev);
> +	struct lisp_sock *ls;
> +	struct lisp_net *ln;
> +
> +	ln = net_generic(lisp->net, lisp_net_id);
> +	mutex_lock(&ln->lock);
> +
> +	ls = rcu_dereference_protected(lisp->sock, lockdep_is_held(&ln->lock));
> +	RCU_INIT_POINTER(lisp->sock, NULL);
> +	if (lisp->collect_md)
> +		RCU_INIT_POINTER(ls->md_dev, NULL);
> +	else
> +		hlist_del_rcu(&lisp->hlist);

[Severity: Medium]
Can this node be linked again before a grace period has passed?

hlist_del_rcu() leaves lisp->hlist.next pointing into the old chain, and
lisp_stop() returns without waiting. __dev_close_many() calls
dev_deactivate_many() before ndo_stop, so the close path does not wait
after this point either.

The next lisp_open() then does:

	hlist_add_head_rcu(&lisp->hlist,
			   lisp_iid_head(found, lisp->iid));

That overwrites lisp->hlist.next. lisp_l3mdev() is computed again on every
open. If the link moved to another VRF while the device was up, found can
be a different lisp_sock than before.

Take a reader on the old socket A that is sitting on this node, in
lisp_udp_encap_recv()->lisp_lookup(). It would follow the new next pointer
into socket B's bucket:

	hlist_for_each_entry_rcu(lisp, lisp_iid_head(ls, iid), hlist)
		if (lisp->iid == iid && rcu_access_pointer(lisp->sock) == ls)
			return lisp;

	return rcu_dereference(ls->md_dev);

Every entry in B's chain fails the lisp->sock == ls test. So any device
that came after the moved node in A's bucket (same hash_32(iid, 10) value)
is skipped. Its packet is then dropped or delivered to A's collect_md
device.

The comment in lisp_lookup() covers stale matches from a device that
moved. Does it also cover valid entries being skipped like this? Memory
stays valid, since lisp_dev and lisp_sock outlive the readers.

Would hlist_del_init_rcu() followed by synchronize_net() in lisp_stop()
avoid this? Delaying the re-add until after a grace period would also
work.

> +
> +	if (--ls->refcnt) {
> +		mutex_unlock(&ln->lock);
> +		return 0;
> +	}

[ ... ]

> +static netdev_tx_t lisp_xmit(struct sk_buff *skb, struct net_device *dev)
> +{

[ ... ]

> +	rcu_read_lock();
> +	ls = rcu_dereference(lisp->sock);
> +	if (!ls)
> +		err = -ESHUTDOWN;
> +	else if (ip_tunnel_info_af(info) == AF_INET)
> +		err = lisp_xmit_skb(skb, dev, ls->sk4, info, iid);
> +	else if (ls->sk6)
> +		err = lisp6_xmit_skb(skb, dev, ls->sk6, info, iid);

[Severity: Low]
Does this link when CONFIG_IPV6=n?

The LISP Kconfig entry only has "depends on INET", so CONFIG_LISP=y or m
with CONFIG_IPV6=n is a valid config. Only the runtime test on ls->sk6
guards this call, so the compiler cannot drop it. lisp6_xmit_skb() calls
udp_tunnel6_dst_lookup() and udp_tunnel6_xmit_skb().

include/net/udp_tunnel.h declares those helpers without !IPV6 stubs. They
are defined only in net/ipv6/ip6_udp_tunnel.c, and net/ipv6/Makefile
builds that file only when CONFIG_IPV6 is set:

ifneq ($(CONFIG_IPV6),)
obj-$(CONFIG_NET_UDP_TUNNEL) += ip6_udp_tunnel.o

With CONFIG_LISP=y the link would fail. With CONFIG_LISP=m, modpost would
report the symbols as undefined. The later patches in the series do not
seem to change lisp.c or the Kconfig dependencies.

bareudp_xmit() avoids this with a guard that folds at compile time:

	if (ipv6_mod_enabled() && info->mode & IP_TUNNEL_INFO_IPV6)

Could this branch test ipv6_mod_enabled() or IS_ENABLED(CONFIG_IPV6)?
Adding "depends on IPV6" to the Kconfig entry would also work.

> +	else
> +		err = -EAFNOSUPPORT;
> +	rcu_read_unlock();

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-for-upstream-lisp-v1-v1-0-7382a4bcfd9b%40free.fr

  reply	other threads:[~2026-11-27 22:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 21:37 [PATCH net-next 0/5] lisp: add a LISP (RFC 9300) tunnel device Vincent Jardin via B4 Relay
2026-11-26 21:37 ` [PATCH net-next 1/5] lisp: add LISP (Locator/ID Separation Protocol) Vincent Jardin via B4 Relay
2026-11-27 22:25   ` netdev-bot+sashiko [this message]
2026-11-26 21:37 ` [PATCH net-next 2/5] netlink: specs: rt-link: add the lisp link type Vincent Jardin via B4 Relay
2026-11-26 21:37 ` [PATCH net-next 3/5] docs: net: document the LISP devices Vincent Jardin via B4 Relay
2026-11-27 22:25   ` netdev-bot+sashiko
2026-11-26 21:37 ` [PATCH net-next 4/5] selftests: net: add a test of " Vincent Jardin via B4 Relay
2026-11-27 22:25   ` netdev-bot+sashiko
2026-11-26 21:37 ` [PATCH net-next 5/5] selftests: net: add a scale test for LISP Vincent Jardin via B4 Relay
2026-11-27 22:25   ` netdev-bot+sashiko
2026-11-27 10:24 ` [PATCH net-next 0/5] lisp: add a LISP (RFC 9300) tunnel device Matthieu Baerts
2026-11-27 22:47   ` Vincent Jardin

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=179581834896.3135.15923750690737278293@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=vjardin@free.fr \
    /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