Patch "ipv4: Fix address dump when IPv4 is disabled on an interface" has been added to the 6.9-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

    ipv4: Fix address dump when IPv4 is disabled on an interface

to the 6.9-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:
     ipv4-fix-address-dump-when-ipv4-is-disabled-on-an-in.patch
and it can be found in the queue-6.9 subdirectory.

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



commit aed202b4490b49790d10e01d5c4acf1b13404769
Author: Ido Schimmel <idosch@xxxxxxxxxx>
Date:   Thu May 23 14:02:57 2024 +0300

    ipv4: Fix address dump when IPv4 is disabled on an interface
    
    [ Upstream commit 7b05ab85e28f615e70520d24c075249b4512044e ]
    
    Cited commit started returning an error when user space requests to dump
    the interface's IPv4 addresses and IPv4 is disabled on the interface.
    Restore the previous behavior and do not return an error.
    
    Before cited commit:
    
     # ip address show dev dummy1
     10: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
         link/ether e2:40:68:98:d0:18 brd ff:ff:ff:ff:ff:ff
         inet6 fe80::e040:68ff:fe98:d018/64 scope link proto kernel_ll
            valid_lft forever preferred_lft forever
     # ip link set dev dummy1 mtu 67
     # ip address show dev dummy1
     10: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 67 qdisc noqueue state UNKNOWN group default qlen 1000
         link/ether e2:40:68:98:d0:18 brd ff:ff:ff:ff:ff:ff
    
    After cited commit:
    
     # ip address show dev dummy1
     10: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
         link/ether 32:2d:69:f2:9c:99 brd ff:ff:ff:ff:ff:ff
         inet6 fe80::302d:69ff:fef2:9c99/64 scope link proto kernel_ll
            valid_lft forever preferred_lft forever
     # ip link set dev dummy1 mtu 67
     # ip address show dev dummy1
     RTNETLINK answers: No such device
     Dump terminated
    
    With this patch:
    
     # ip address show dev dummy1
     10: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
         link/ether de:17:56:bb:57:c0 brd ff:ff:ff:ff:ff:ff
         inet6 fe80::dc17:56ff:febb:57c0/64 scope link proto kernel_ll
            valid_lft forever preferred_lft forever
     # ip link set dev dummy1 mtu 67
     # ip address show dev dummy1
     10: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 67 qdisc noqueue state UNKNOWN group default qlen 1000
         link/ether de:17:56:bb:57:c0 brd ff:ff:ff:ff:ff:ff
    
    I fixed the exact same issue for IPv6 in commit c04f7dfe6ec2 ("ipv6: Fix
    address dump when IPv6 is disabled on an interface"), but noted [1] that
    I am not doing the change for IPv4 because I am not aware of a way to
    disable IPv4 on an interface other than unregistering it. I clearly
    missed the above case.
    
    [1] https://lore.kernel.org/netdev/20240321173042.2151756-1-idosch@xxxxxxxxxx/
    
    Fixes: cdb2f80f1c10 ("inet: use xa_array iterator to implement inet_dump_ifaddr()")
    Reported-by: Carolina Jubran <cjubran@xxxxxxxxxx>
    Reported-by: Yamen Safadi <ysafadi@xxxxxxxxxx>
    Tested-by: Carolina Jubran <cjubran@xxxxxxxxxx>
    Reviewed-by: Petr Machata <petrm@xxxxxxxxxx>
    Signed-off-by: Ido Schimmel <idosch@xxxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240523110257.334315-1-idosch@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7e45c34c8340a..ee5fbc19b85fc 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1882,10 +1882,11 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
 			goto done;
 
 		if (fillargs.ifindex) {
-			err = -ENODEV;
 			dev = dev_get_by_index_rcu(tgt_net, fillargs.ifindex);
-			if (!dev)
+			if (!dev) {
+				err = -ENODEV;
 				goto done;
+			}
 			in_dev = __in_dev_get_rcu(dev);
 			if (!in_dev)
 				goto done;




[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