network: fix an infinite loop

Fixes #19467.
This commit is contained in:
Yu Watanabe
2021-05-21 12:03:01 +09:00
parent 670427a4d4
commit e8f99f4e24
+6
View File
@@ -179,6 +179,12 @@ static void link_update_master_operstate(Link *link, NetDev *netdev) {
if (netdev->ifindex <= 0)
return;
/* If an interface is self-mentioned in Bridge= or friends, then it introduces an infinite loop.
* FIXME: there still exits a possibility of an infinite loop when two or more interfaces
* mention each other in Bridge= or so. We need to detect such a loop. */
if (link->ifindex == netdev->ifindex)
return;
if (link_get(link->manager, netdev->ifindex, &master) < 0)
return;