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