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 <alex…@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 <alex…@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))
Re: [PATCH net v2] ipv6: reject permanent flag on temporary addresses
- From
- alex…@gmail.com (zhuorao yang)
- Organization
- Usenet Network
- Message-ID
- <bf54…@kernelpatch.local>
- Date
- Newsgroups
- linux.kernel.netdev