hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/net/ipv4/devinet.c
....@@ -351,14 +351,14 @@
351351 {
352352 struct in_ifaddr *promote = NULL;
353353 struct in_ifaddr *ifa, *ifa1;
354
- struct in_ifaddr *last_prim;
354
+ struct in_ifaddr __rcu **last_prim;
355355 struct in_ifaddr *prev_prom = NULL;
356356 int do_promote = IN_DEV_PROMOTE_SECONDARIES(in_dev);
357357
358358 ASSERT_RTNL();
359359
360360 ifa1 = rtnl_dereference(*ifap);
361
- last_prim = rtnl_dereference(in_dev->ifa_list);
361
+ last_prim = ifap;
362362 if (in_dev->dead)
363363 goto no_promotions;
364364
....@@ -372,7 +372,7 @@
372372 while ((ifa = rtnl_dereference(*ifap1)) != NULL) {
373373 if (!(ifa->ifa_flags & IFA_F_SECONDARY) &&
374374 ifa1->ifa_scope <= ifa->ifa_scope)
375
- last_prim = ifa;
375
+ last_prim = &ifa->ifa_next;
376376
377377 if (!(ifa->ifa_flags & IFA_F_SECONDARY) ||
378378 ifa1->ifa_mask != ifa->ifa_mask ||
....@@ -436,9 +436,9 @@
436436
437437 rcu_assign_pointer(prev_prom->ifa_next, next_sec);
438438
439
- last_sec = rtnl_dereference(last_prim->ifa_next);
439
+ last_sec = rtnl_dereference(*last_prim);
440440 rcu_assign_pointer(promote->ifa_next, last_sec);
441
- rcu_assign_pointer(last_prim->ifa_next, promote);
441
+ rcu_assign_pointer(*last_prim, promote);
442442 }
443443
444444 promote->ifa_flags &= ~IFA_F_SECONDARY;