summaryrefslogtreecommitdiff
path: root/drivers/net/dummy.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2024-11-07 16:48:14 -0800
committerJakub Kicinski <kuba@kernel.org>2024-11-11 17:26:51 -0800
commitd5ec8d91f82ef78405b506737952dec8af95a95b (patch)
tree3f0acb083bb7c11e715ec7f03fc8423b4e5cfa10 /drivers/net/dummy.c
parent7a3bcd39ae1f0e3ab896d9df62339ab4297a0bfd (diff)
downloadlinux-next-d5ec8d91f82ef78405b506737952dec8af95a95b.tar.gz
linux-next-d5ec8d91f82ef78405b506737952dec8af95a95b.zip
rtnetlink: Remove __rtnl_link_unregister().
rtnl_link_unregister() holds RTNL and calls __rtnl_link_unregister(), where we call synchronize_srcu() to wait inflight RTM_NEWLINK requests for per-netns RTNL. We put synchronize_srcu() in __rtnl_link_unregister() due to ifb.ko and dummy.ko. However, rtnl_newlink() will acquire SRCU before RTNL later in this series. Then, lockdep will detect the deadlock: rtnl_link_unregister() rtnl_newlink() ---- ---- lock(rtnl_mutex); lock(&ops->srcu); lock(rtnl_mutex); sync(&ops->srcu); To avoid the problem, we must call synchronize_srcu() before RTNL in rtnl_link_unregister(). As a preparation, let's remove __rtnl_link_unregister(). Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20241108004823.29419-2-kuniyu@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/dummy.c')
-rw-r--r--drivers/net/dummy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index e9c5e1e11fa0..72618b6af44e 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -166,6 +166,7 @@ err:
static int __init dummy_init_module(void)
{
+ bool need_unregister = false;
int i, err = 0;
down_write(&pernet_ops_rwsem);
@@ -179,12 +180,15 @@ static int __init dummy_init_module(void)
cond_resched();
}
if (err < 0)
- __rtnl_link_unregister(&dummy_link_ops);
+ need_unregister = true;
out:
rtnl_unlock();
up_write(&pernet_ops_rwsem);
+ if (need_unregister)
+ rtnl_link_unregister(&dummy_link_ops);
+
return err;
}