Eric Dumazet
d7ee3bf0ca
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:05:02 +02:00
..
2024-04-10 16:28:30 +02:00
2022-12-31 13:33:02 +01:00
2024-01-31 16:17:04 -08:00
2023-12-20 17:00:19 +01:00
2023-12-20 17:00:17 +01:00
2023-12-20 17:00:16 +01:00
2024-04-10 16:28:24 +02:00
2023-03-17 08:50:32 +01:00
2024-04-10 16:28:25 +02:00
2023-03-17 08:50:24 +01:00
2024-02-23 09:12:47 +01:00
2023-10-19 23:08:56 +02:00
2024-04-10 16:28:26 +02:00
2023-08-11 12:08:17 +02:00
2023-11-20 11:52:16 +01:00
2023-09-23 11:11:01 +02:00
2024-01-25 15:27:38 -08:00
2023-07-19 16:22:06 +02:00
2024-01-25 15:27:51 -08:00
2024-03-26 18:21:00 -04:00
2024-01-01 12:38:56 +00:00
2024-04-10 16:28:29 +02:00
2024-04-10 16:28:27 +02:00
2024-03-26 18:20:25 -04:00
2024-03-26 18:20:42 -04:00
2023-08-23 17:52:32 +02:00
2024-03-26 18:20:42 -04:00
2024-02-05 20:13:01 +00:00
2024-04-03 15:19:48 +02:00
2024-04-03 15:19:31 +02:00
2024-03-26 18:20:37 -04:00
2023-02-22 12:59:53 +01:00
2024-04-10 16:28:34 +02:00
2024-01-25 15:27:24 -08:00
2024-04-10 16:28:25 +02:00
2024-01-25 15:27:20 -08:00
2024-03-06 14:45:06 +00:00
2024-03-15 10:48:18 -04:00
2024-04-10 16:28:21 +02:00
2023-05-24 17:32:45 +01:00
2024-02-23 09:12:30 +01:00
2024-03-26 18:20:59 -04:00
2024-03-01 13:26:38 +01:00
2023-12-13 18:39:11 +01:00
2024-01-20 11:50:09 +01:00
2024-04-10 16:28:25 +02:00
2024-01-01 12:39:04 +00:00
2024-01-01 12:38:57 +00:00
2024-02-16 19:06:27 +01:00
2024-04-10 16:28:26 +02:00
2024-01-25 15:27:30 -08:00
2024-04-13 13:05:02 +02:00
2024-03-26 18:20:55 -04:00
2024-03-01 13:26:35 +01:00
2024-02-16 19:06:27 +01:00
2024-04-10 16:28:22 +02:00
2024-03-26 18:20:31 -04:00
2024-04-10 16:28:25 +02:00
2024-03-06 14:45:10 +00:00
2024-03-26 18:20:42 -04:00
2023-12-13 18:39:08 +01:00
2024-04-03 15:19:40 +02:00
2023-02-09 11:28:04 +01:00
2023-08-30 16:11:00 +02:00
2024-01-10 17:10:27 +01:00