Eric Dumazet
b9117dc783
net/smc: reduce rtnl pressure in smc_pnet_create_pnetids_list()
...
[ Upstream commit 00af2aa93b76b1bade471ad0d0525d4d29ca5cc0 ]
Many syzbot reports show extreme rtnl pressure, and many of them hint
that smc acquires rtnl in netns creation for no good reason [1]
This patch returns early from smc_pnet_net_init()
if there is no netdevice yet.
I am not even sure why smc_pnet_create_pnetids_list() even exists,
because smc_pnet_netdev_event() is also calling
smc_pnet_add_base_pnetid() when handling NETDEV_UP event.
[1] extract of typical syzbot reports
2 locks held by syz-executor.3/12252:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.4/12253:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.1/12257:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.2/12261:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.0/12265:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.3/12268:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.4/12271:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.1/12274:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
2 locks held by syz-executor.2/12280:
#0 : ffffffff8f369610 (pernet_ops_rwsem){++++}-{3:3}, at: copy_net_ns+0x4c7/0x7b0 net/core/net_namespace.c:491
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_create_pnetids_list net/smc/smc_pnet.c:809 [inline]
#1 : ffffffff8f375b88 (rtnl_mutex){+.+.}-{3:3}, at: smc_pnet_net_init+0x10a/0x1e0 net/smc/smc_pnet.c:878
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Wenjia Zhang <wenjia@linux.ibm.com>
Cc: Jan Karcher <jaka@linux.ibm.com>
Cc: "D. Wythe" <alibuda@linux.alibaba.com>
Cc: Tony Lu <tonylu@linux.alibaba.com>
Cc: Wen Gu <guwen@linux.alibaba.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Link: https://lore.kernel.org/r/20240302100744.3868021-1-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-13 13:01:44 +02:00
..
2024-01-05 15:13:34 +01:00
2022-12-31 13:14:42 +01:00
2024-02-23 08:54:27 +01:00
2023-12-20 15:17:37 +01:00
2023-12-20 15:17:35 +01:00
2022-06-22 14:22:01 +02:00
2023-12-20 15:17:35 +01:00
2024-04-10 16:19:37 +02:00
2022-12-31 13:14:11 +01:00
2024-04-10 16:19:38 +02:00
2023-03-17 08:48:54 +01:00
2024-02-23 08:55:10 +01:00
2023-10-19 23:05:36 +02:00
2024-04-10 16:19:43 +02:00
2023-08-11 15:13:53 +02:00
2023-11-28 16:56:22 +00:00
2024-01-25 14:52:46 -08:00
2024-04-13 13:01:42 +02:00
2024-01-25 14:52:54 -08:00
2024-03-26 18:21:36 -04:00
2022-11-03 23:59:14 +09:00
2024-01-05 15:13:29 +01:00
2024-04-10 16:19:39 +02:00
2024-04-10 16:19:39 +02:00
2024-03-26 18:21:13 -04:00
2024-03-26 18:21:23 -04:00
2023-08-26 14:23:32 +02:00
2024-03-26 18:21:23 -04:00
2022-04-27 14:38:53 +02:00
2024-02-23 08:54:54 +01:00
2024-04-10 16:19:31 +02:00
2024-04-10 16:18:39 +02:00
2023-10-25 11:58:59 +02:00
2023-02-22 12:57:09 +01:00
2024-04-10 16:19:43 +02:00
2024-01-25 14:52:36 -08:00
2024-04-10 16:19:38 +02:00
2024-01-25 14:52:33 -08:00
2024-03-06 14:38:45 +00:00
2024-03-15 10:48:17 -04:00
2024-04-10 16:19:35 +02:00
2023-05-24 17:36:51 +01:00
2024-02-23 08:55:02 +01:00
2024-03-26 18:21:35 -04:00
2022-01-11 15:35:16 +01:00
2023-12-13 18:36:37 +01:00
2024-01-25 14:52:30 -08:00
2024-04-10 16:19:37 +02:00
2024-01-05 15:13:34 +01:00
2024-01-05 15:13:29 +01:00
2024-02-23 08:54:58 +01:00
2024-04-10 16:19:38 +02:00
2023-10-10 21:59:08 +02:00
2024-04-13 13:01:44 +02:00
2024-04-10 16:19:28 +02:00
2024-02-23 08:54:58 +01:00
2024-03-06 14:38:51 +00:00
2024-03-26 18:21:17 -04:00
2024-01-25 14:52:38 -08:00
2024-03-06 14:38:48 +00:00
2024-03-26 18:21:23 -04:00
2023-09-19 12:22:58 +02:00
2024-04-10 16:18:45 +02:00
2023-06-21 15:59:15 +02:00
2023-06-21 15:59:15 +02:00
2024-01-15 18:51:16 +01:00