Patch "ipv6 addrconf: fix bug where deleting a mngtmpaddr can create a new temporary address" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ipv6 addrconf: fix bug where deleting a mngtmpaddr can create a new temporary address

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ipv6-addrconf-fix-bug-where-deleting-a-mngtmpaddr-ca.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cd96f9175443a52db109dd31dc63caece54f2cb4
Author: Maciej Żenczykowski <maze@xxxxxxxxxx>
Date:   Thu Jul 20 09:00:22 2023 -0700

    ipv6 addrconf: fix bug where deleting a mngtmpaddr can create a new temporary address
    
    [ Upstream commit 69172f0bcb6a09110c5d2a6d792627f5095a9018 ]
    
    currently on 6.4 net/main:
    
      # ip link add dummy1 type dummy
      # echo 1 > /proc/sys/net/ipv6/conf/dummy1/use_tempaddr
      # ip link set dummy1 up
      # ip -6 addr add 2000::1/64 mngtmpaddr dev dummy1
      # ip -6 addr show dev dummy1
    
      11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
          inet6 2000::44f3:581c:8ca:3983/64 scope global temporary dynamic
             valid_lft 604800sec preferred_lft 86172sec
          inet6 2000::1/64 scope global mngtmpaddr
             valid_lft forever preferred_lft forever
          inet6 fe80::e8a8:a6ff:fed5:56d4/64 scope link
             valid_lft forever preferred_lft forever
    
      # ip -6 addr del 2000::44f3:581c:8ca:3983/64 dev dummy1
    
      (can wait a few seconds if you want to, the above delete isn't [directly] the problem)
    
      # ip -6 addr show dev dummy1
    
      11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
          inet6 2000::1/64 scope global mngtmpaddr
             valid_lft forever preferred_lft forever
          inet6 fe80::e8a8:a6ff:fed5:56d4/64 scope link
             valid_lft forever preferred_lft forever
    
      # ip -6 addr del 2000::1/64 mngtmpaddr dev dummy1
      # ip -6 addr show dev dummy1
    
      11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
          inet6 2000::81c9:56b7:f51a:b98f/64 scope global temporary dynamic
             valid_lft 604797sec preferred_lft 86169sec
          inet6 fe80::e8a8:a6ff:fed5:56d4/64 scope link
             valid_lft forever preferred_lft forever
    
    This patch prevents this new 'global temporary dynamic' address from being
    created by the deletion of the related (same subnet prefix) 'mngtmpaddr'
    (which is triggered by there already being no temporary addresses).
    
    Cc: Jiri Pirko <jiri@xxxxxxxxxxx>
    Fixes: 53bd67491537 ("ipv6 addrconf: introduce IFA_F_MANAGETEMPADDR to tell kernel to manage temporary addresses")
    Reported-by: Xiao Ma <xiaom@xxxxxxxxxx>
    Signed-off-by: Maciej Żenczykowski <maze@xxxxxxxxxx>
    Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230720160022.1887942-1-maze@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6703a5b65e4a6..893b93cc5221a 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2436,12 +2436,18 @@ static void manage_tempaddrs(struct inet6_dev *idev,
 			ipv6_ifa_notify(0, ift);
 	}
 
-	if ((create || list_empty(&idev->tempaddr_list)) &&
-	    idev->cnf.use_tempaddr > 0) {
+	/* Also create a temporary address if it's enabled but no temporary
+	 * address currently exists.
+	 * However, we get called with valid_lft == 0, prefered_lft == 0, create == false
+	 * as part of cleanup (ie. deleting the mngtmpaddr).
+	 * We don't want that to result in creating a new temporary ip address.
+	 */
+	if (list_empty(&idev->tempaddr_list) && (valid_lft || prefered_lft))
+		create = true;
+
+	if (create && idev->cnf.use_tempaddr > 0) {
 		/* When a new public address is created as described
 		 * in [ADDRCONF], also create a new temporary address.
-		 * Also create a temporary address if it's enabled but
-		 * no temporary address currently exists.
 		 */
 		read_unlock_bh(&idev->lock);
 		ipv6_create_tempaddr(ifp, NULL);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux