netwrok: call link_drop_unmanaged_config() earlier in link_configure()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Nov 2024 11:38:42 +0000 (20:38 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Nov 2024 02:53:24 +0000 (11:53 +0900)
Otherwise, even if a link enters the configuring state at the beginning
of link_configure(), link_check_ready() may be called before
link_drop_unmanaged_config() is called, and the link may enter the
configured state.

Fixes #35092.

src/network/networkd-link.c

index 080e6beff3b04920b533547f33544e6d0539d067..ab74260adbe9fb49a1df0e41350780e81fbaac12 100644 (file)
@@ -1148,6 +1148,10 @@ static int link_configure(Link *link) {
 
         link_set_state(link, LINK_STATE_CONFIGURING);
 
+        r = link_drop_unmanaged_config(link);
+        if (r < 0)
+                return r;
+
         r = link_new_bound_to_list(link);
         if (r < 0)
                 return r;
@@ -1253,10 +1257,6 @@ static int link_configure(Link *link) {
         if (r < 0)
                 return r;
 
-        r = link_drop_unmanaged_config(link);
-        if (r < 0)
-                return r;
-
         r = link_request_static_configs(link);
         if (r < 0)
                 return r;