Kuniyuki Iwashima 6b57ff21a3 rtnetlink: Protect link_ops by mutex.
rtnl_link_unregister() holds RTNL and calls synchronize_srcu(),
but rtnl_newlink() will acquire SRCU frist and then RTNL.

Then, we need to unlink ops and call synchronize_srcu() outside
of RTNL to avoid the deadlock.

   rtnl_link_unregister()       rtnl_newlink()
   ----                         ----
   lock(rtnl_mutex);
                                lock(&ops->srcu);
                                lock(rtnl_mutex);
   sync(&ops->srcu);

Let's move as such and add a mutex to protect link_ops.

Now, link_ops is protected by its dedicated mutex and
rtnl_link_register() no longer needs to hold RTNL.

While at it, we move the initialisation of ops->dellink and
ops->srcu out of the mutex scope.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241108004823.29419-3-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-11-11 17:26:51 -08:00
..
2024-10-14 17:54:29 -07:00
2024-09-11 20:44:32 -07:00
2024-11-03 14:44:51 -08:00
2024-03-07 21:12:41 -08:00
2024-10-15 18:52:26 -07:00
2024-04-01 10:49:28 +01:00
2024-09-11 20:44:31 -07:00
2024-09-02 18:43:58 +02:00
2024-06-06 11:52:52 +02:00
2024-08-26 09:37:23 -07:00