lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5a58a1a6425c565bb0ba7f46461fdd23cedb6b72.1600770261.git.sd@queasysnail.net>
Date:   Thu,  1 Oct 2020 09:59:34 +0200
From:   Sabrina Dubroca <sd@...asysnail.net>
To:     netdev@...r.kernel.org
Cc:     Sabrina Dubroca <sd@...asysnail.net>
Subject: [PATCH net 10/12] net: link_watch: fix detection of urgent events

linkwatch_urgent_event can miss urgent events when the device and its
link have the same ifindex, which can happen when those devices are in
different network namespaces.

With this setup, the vlan0 device can remain in LOWERLAYERDOWN state
for a full second (the linkwatch delay for non-urgent events), while
the vlan1 device will come up immediately:

    ip netns add a
    ip netns add b
    ip -net a link add dummy0 type dummy
    ip -net a link add link dummy0 vlan0 netns b type vlan id 1
    ip -net a link add link dummy0 vlan1 netns b type vlan id 2

    ip -net a link set dummy0 up
    ip -net b link set vlan1 down ; ip -net b link set vlan0 down
    sleep 2
    ip -net b link set vlan1 up   ; ip -net b link set vlan0 up

Fixes: d8a5ec672768 ("[NET]: netlink support for moving devices between network namespaces.")
Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
---
 net/core/link_watch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 6932ad51aa4a..8a5d0ab820f9 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -92,7 +92,7 @@ static bool linkwatch_urgent_event(struct net_device *dev)
 	if (!netif_running(dev))
 		return false;
 
-	if (dev->ifindex != dev_get_iflink(dev))
+	if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
 		return true;
 
 	if (netif_is_lag_port(dev) || netif_is_lag_master(dev))
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ