Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Zhiling Zou <zhilinz@nebusec.ai>,  netdev@vger.kernel.org
Cc: willemdebruijn.kernel@gmail.com,  jasowangio@gmail.com,
	 andrew+netdev@lunn.ch,  davem@davemloft.net,
	 edumazet@google.com,  pabeni@redhat.com,  phil@philpotter.co.uk,
	 vega@nebusec.ai,  zhilinz@nebusec.ai
Subject: Re: [PATCH net 1/1] net: tun: reject addr_len changes with active lists
Date: Mon, 31 Aug 2026 13:47:09 -0400	[thread overview]
Message-ID: <willemdebruijn.kernel.388312d1b377d@gmail.com> (raw)
In-Reply-To: <07d1a274b5144fe2ad8e30a6d3d25a5b8ea88fa7.1787998545.git.zhilinz@nebusec.ai>

Zhiling Zou wrote:
> TUNSETLINK can change a TAP device's address length while packet
> memberships are active. The address lists are keyed by the current
> address length, so changing it makes subsequent membership cleanup
> lookups fail and strands netdev_hw_addr entries until unregister.
> 
> Reject link-type changes that alter addr_len while either the unicast or
> multicast address list is non-empty. This prevents address entries from
> becoming unreachable through the normal deletion path.
> 
> Fixes: cca8ea3b05c9 ("net: tun: set tun->dev->addr_len during TUNSETLINK processing")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
> ---
>  drivers/net/tun.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 5a302709a68aa..e5b7729a967de 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -3341,6 +3341,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
>  			netif_info(tun, drv, tun->dev,
>  				   "Linktype set failed because interface is up\n");
>  			ret = -EBUSY;
> +		} else if (tun_get_addr_len(arg) != tun->dev->addr_len &&
> +			   (!netdev_uc_empty(tun->dev) ||
> +			    !netdev_mc_empty(tun->dev))) {
> +			ret = -EBUSY;

Insightful comments from the bots

- IPv6 sockets automatically join the all-node multicast groups in
  ipv6_add_dev, so netdev_mc_empty is false for them from the start

- IPv6 membership may already be safe, so could be ignored

- netdev_[mu]c_empty locking requires a different lock held

      reply	other threads:[~2026-08-31 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29 10:23 [PATCH net 0/1] net: tun: reject addr_len changes with active lists Zhiling Zou
2026-08-29 10:23 ` [PATCH net 1/1] " Zhiling Zou
2026-08-31 17:47   ` Willem de Bruijn [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=willemdebruijn.kernel.388312d1b377d@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jasowangio@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phil@philpotter.co.uk \
    --cc=vega@nebusec.ai \
    --cc=zhilinz@nebusec.ai \
    /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