All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhuorao yang <alex000young@gmail.com>
To: johan@kernel.org
Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	willemb@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH net v2] ipv6: reject permanent flag on temporary addresses
Date: Thu, 03 Dec 2026 18:27:22 -0800 (PST)	[thread overview]
Message-ID: <bf54add17e884aa5853605ca2d8ea6f7@kernelpatch.local> (raw)
In-Reply-To: <axEqL4y2QHIaJ8T2@hovoldconsulting.com>

Hi Johan,

Sorry for the mistake. v1 was already public, so v2 should have stayed in
the same public thread and included Ido and the other maintainers. I
incorrectly sent v2 only to the security address.

I am resending the v2 patch below and will keep all follow-ups on this
thread with the original maintainers and lists Cc'd.

Thanks,
zhuorao yang

From db6f7539c0976c8199553890603d8bd39adc09e1 Mon Sep 17 00:00:00 2001
From: zhuorao yang <alex000young@gmail.com>
Date: Wed, 2 Dec 2026 15:02:22 +0800
Subject: [PATCH net v2] ipv6: reject permanent flag on temporary addresses

When userspace omits IFA_CACHEINFO, RTM_NEWADDR initially marks an
address permanent.  A finite valid lifetime clears that flag before the
address is modified.  inet6_addr_modify() clears the permanent bit on
the existing address and then ORs the requested flags back, but leaves
IFA_F_TEMPORARY set.  In the no-cacheinfo case this creates a temporary
address with permanent semantics.

If keep_addr_on_down is enabled, addrconf_ifdown() first removes the
address from tempaddr_list and then preserves it because it is marked
permanent.  A later RTM_DELADDR calls ipv6_del_addr(), which deletes the
already poisoned tmp_list node:

  BUG: KASAN: maybe wild-memory-access in range
  [0xdead000000000108-0xdead00000000010f]
  Oops: general protection fault
   ipv6_del_addr
   inet6_addr_del
   inet6_rtm_deladdr

Temporary addresses are never permanent.  Clear IFA_F_PERMANENT from
the requested flags when modifying a temporary address so that the
existing replace operation remains supported without creating an
invalid flag combination.

Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional")
Signed-off-by: zhuorao yang <alex000young@gmail.com>
---
 net/ipv6/addrconf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d9d13e78bf13..8d7c316f3eb2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4928,6 +4928,10 @@ static int inet6_addr_modify(struct net *net, struct inet6_ifaddr *ifp,
 	if (!(ifp->flags & IFA_F_TENTATIVE) || ifp->flags & IFA_F_DADFAILED)
 		cfg->ifa_flags &= ~IFA_F_OPTIMISTIC;
 
+	/* Temporary addresses are never permanent */
+	if (ifp->flags & IFA_F_TEMPORARY)
+		cfg->ifa_flags &= ~IFA_F_PERMANENT;
+
 	if (cfg->peer_pfx &&
 	    memcmp(&ifp->peer_addr, cfg->peer_pfx, sizeof(struct in6_addr))) {
 		if (!ipv6_addr_any(&ifp->peer_addr))

      parent reply	other threads:[~2026-12-04  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 12:26 [PATCH net] ipv6: reject permanent flag on temporary addresses zhuorao yang
2026-12-01 15:14 ` Ido Schimmel
     [not found] ` <69abf63fb4834193b3cea20ee57d2151@kernelpatch.local>
     [not found]   ` <axEqL4y2QHIaJ8T2@hovoldconsulting.com>
2026-12-04  2:27     ` zhuorao yang [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=bf54add17e884aa5853605ca2d8ea6f7@kernelpatch.local \
    --to=alex000young@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=johan@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.