Julian Anastasov
0d450977ae
ipvs: defer hook registration to avoid leaks
[ Upstream commit cf47a0b882a4e5f6b34c7949d7b293e9287f1972 ]
syzkaller reports for memory leak when registering hooks [1]
As we moved the nf_unregister_net_hooks() call into
__ip_vs_dev_cleanup(), defer the nf_register_net_hooks()
call, so that hooks are allocated and freed from same
pernet_operations (ipvs_core_dev_ops).
[1]
BUG: memory leak
unreferenced object 0xffff88810acd8a80 (size 96):
comm "syz-executor073", pid 7254, jiffies 4294950560 (age 22.250s)
hex dump (first 32 bytes):
02 00 00 00 00 00 00 00 50 8b bb 82 ff ff ff ff ........P.......
00 00 00 00 00 00 00 00 00 77 bb 82 ff ff ff ff .........w......
backtrace:
[<0000000013db61f1>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
[<0000000013db61f1>] slab_post_alloc_hook mm/slab.h:439 [inline]
[<0000000013db61f1>] slab_alloc_node mm/slab.c:3269 [inline]
[<0000000013db61f1>] kmem_cache_alloc_node_trace+0x15b/0x2a0 mm/slab.c:3597
[<000000001a27307d>] __do_kmalloc_node mm/slab.c:3619 [inline]
[<000000001a27307d>] __kmalloc_node+0x38/0x50 mm/slab.c:3627
[<0000000025054add>] kmalloc_node include/linux/slab.h:590 [inline]
[<0000000025054add>] kvmalloc_node+0x4a/0xd0 mm/util.c:431
[<0000000050d1bc00>] kvmalloc include/linux/mm.h:637 [inline]
[<0000000050d1bc00>] kvzalloc include/linux/mm.h:645 [inline]
[<0000000050d1bc00>] allocate_hook_entries_size+0x3b/0x60 net/netfilter/core.c:61
[<00000000e8abe142>] nf_hook_entries_grow+0xae/0x270 net/netfilter/core.c:128
[<000000004b94797c>] __nf_register_net_hook+0x9a/0x170 net/netfilter/core.c:337
[<00000000d1545cbc>] nf_register_net_hook+0x34/0xc0 net/netfilter/core.c:464
[<00000000876c9b55>] nf_register_net_hooks+0x53/0xc0 net/netfilter/core.c:480
[<000000002ea868e0>] __ip_vs_init+0xe8/0x170 net/netfilter/ipvs/ip_vs_core.c:2280
[<000000002eb2d451>] ops_init+0x4c/0x140 net/core/net_namespace.c:130
[<000000000284ec48>] setup_net+0xde/0x230 net/core/net_namespace.c:316
[<00000000a70600fa>] copy_net_ns+0xf0/0x1e0 net/core/net_namespace.c:439
[<00000000ff26c15e>] create_new_namespaces+0x141/0x2a0 kernel/nsproxy.c:107
[<00000000b103dc79>] copy_namespaces+0xa1/0xe0 kernel/nsproxy.c:165
[<000000007cc008a2>] copy_process.part.0+0x11fd/0x2150 kernel/fork.c:2035
[<00000000c344af7c>] copy_process kernel/fork.c:1800 [inline]
[<00000000c344af7c>] _do_fork+0x121/0x4f0 kernel/fork.c:2369
Reported-by: syzbot+722da59ccb264bc19910@syzkaller.appspotmail.com
Fixes: 719c7d563c17 ("ipvs: Fix use-after-free in ip_vs_in")
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-31 07:28:27 +02:00
..
2019-07-31 07:28:24 +02:00
2019-07-31 07:28:27 +02:00
2017-09-08 18:55:52 +02:00
2017-07-31 19:01:40 +02:00
2017-11-02 11:10:55 +01:00
2017-04-26 09:30:22 +02:00
2017-06-19 19:13:21 +02:00
2017-07-24 13:24:46 +02:00
2019-05-16 19:42:23 +02:00
2017-04-26 09:30:22 +02:00
2017-09-04 13:25:19 +02:00
2017-09-04 13:25:19 +02:00
2017-04-19 17:55:17 +02:00
2016-07-11 12:32:45 +02:00
2017-06-19 19:13:21 +02:00
2018-08-24 13:08:57 +02:00
2017-04-19 17:55:17 +02:00
2017-08-24 18:52:32 +02:00
2017-04-26 09:30:22 +02:00
2017-04-19 17:55:16 +02:00
2019-05-16 19:42:23 +02:00
2017-07-24 13:24:46 +02:00
2018-08-24 13:09:22 +02:00
2017-09-04 13:25:18 +02:00
2017-09-04 13:25:18 +02:00
2017-09-04 13:25:18 +02:00
2017-09-04 13:25:18 +02:00
2017-09-04 13:25:18 +02:00
2017-08-24 18:52:33 +02:00
2017-04-19 17:55:17 +02:00
2019-01-13 10:00:57 +01:00
2017-07-24 13:24:46 +02:00
2017-09-04 13:25:19 +02:00
2017-04-19 17:55:17 +02:00
2017-04-26 09:30:22 +02:00
2017-04-26 09:30:22 +02:00
2017-05-29 11:32:36 +02:00
2017-11-02 11:10:55 +01:00
2016-12-04 20:45:33 +01:00
2016-12-04 20:45:33 +01:00
2018-08-24 13:09:07 +02:00
2017-04-06 22:01:38 +02:00
2019-01-13 10:00:58 +01:00
2017-04-06 22:01:38 +02:00
2017-04-06 22:01:38 +02:00
2018-03-15 10:54:23 +01:00
2016-12-04 20:45:30 +01:00
2017-07-01 09:08:41 -07:00
2017-01-03 14:33:25 +01:00
2017-09-04 13:25:19 +02:00
2019-06-22 08:16:15 +02:00
2017-11-02 11:10:55 +01:00
2017-05-17 16:06:01 -04:00
2019-05-16 19:42:30 +02:00
2018-07-08 15:30:50 +02:00
2016-09-12 19:54:45 +02:00
2017-04-06 18:32:04 +02:00
2017-07-31 20:41:57 +02:00
2018-09-15 09:45:28 +02:00
2018-01-31 14:03:41 +01:00
2017-08-24 18:52:33 +02:00
2017-08-02 14:25:59 +02:00
2018-07-17 11:39:32 +02:00
2017-07-17 13:27:46 +02:00
2017-05-15 12:51:41 +02:00
2016-11-09 23:42:23 +01:00
2017-05-15 12:51:41 +02:00
2019-02-27 10:08:08 +01:00
2017-09-04 13:25:09 +02:00
2018-06-16 09:45:14 +02:00
2017-05-03 10:11:26 -04:00
2017-08-28 17:42:56 +02:00
2016-11-03 11:52:34 +01:00
2017-07-31 19:01:40 +02:00
2017-03-13 13:45:36 +01:00
2016-12-06 21:48:22 +01:00
2017-05-01 10:47:53 -04:00
2018-07-08 15:30:49 +02:00
2018-07-08 15:30:51 +02:00
2017-01-24 21:46:29 +01:00
2017-03-06 18:23:23 +01:00
2017-03-06 18:22:12 +01:00
2018-07-08 15:30:49 +02:00
2017-03-23 16:41:27 -07:00
2017-04-07 18:24:47 +02:00
2017-09-04 13:25:09 +02:00
2017-08-28 17:42:56 +02:00
2017-04-07 18:24:47 +02:00
2017-09-04 13:25:09 +02:00
2017-05-15 12:51:41 +02:00
2017-03-06 18:22:12 +01:00
2017-03-06 18:22:12 +01:00
2017-03-06 18:22:12 +01:00
2017-08-28 18:14:30 +02:00
2017-05-29 12:46:18 +02:00
2018-09-05 09:26:27 +02:00
2019-05-04 09:15:18 +02:00
2019-05-16 19:42:18 +02:00
2017-07-24 13:24:46 +02:00
2017-05-02 10:16:04 -04:00
2018-02-25 11:08:01 +01:00
2019-04-20 09:15:04 +02:00
2018-10-10 08:54:23 +02:00
2016-12-04 21:16:50 +01:00
2017-04-15 11:51:33 +02:00
2019-01-09 17:14:51 +01:00
2017-04-15 11:51:33 +02:00
2016-12-04 21:16:50 +01:00
2017-04-15 11:47:57 +02:00
2017-08-24 18:52:33 +02:00
2016-11-03 10:56:21 +01:00
2016-11-03 10:56:21 +01:00
2018-12-17 09:28:49 +01:00
2016-12-04 21:16:50 +01:00
2017-04-15 11:51:33 +02:00
2018-11-27 16:10:48 +01:00
2016-10-17 17:38:19 +02:00
2017-04-15 11:51:33 +02:00
2018-04-26 11:02:13 +02:00
2018-04-26 11:02:13 +02:00
2016-11-03 10:56:21 +01:00
2016-12-06 21:48:20 +01:00
2017-09-04 13:25:19 +02:00
2017-09-04 13:25:19 +02:00
2018-04-26 11:02:13 +02:00
2016-11-03 10:56:21 +01:00
2016-11-03 10:56:21 +01:00
2018-01-31 14:03:41 +01:00
2017-03-02 08:42:31 +01:00
2019-04-05 22:31:39 +02:00
2017-01-18 20:32:43 +01:00
2016-11-03 10:56:21 +01:00
2017-01-09 17:24:55 +01:00
2017-01-09 17:24:55 +01:00
2018-02-25 11:07:50 +01:00
2018-04-08 14:26:29 +02:00
2016-12-04 21:16:51 +01:00
2017-11-02 11:10:55 +01:00
2017-07-01 09:08:41 -07:00
2016-11-10 13:28:42 +01:00
2017-09-26 20:04:34 +02:00
2017-04-15 11:47:57 +02:00
2018-04-26 11:02:13 +02:00
2017-01-09 17:24:55 +01:00
2017-07-24 13:24:46 +02:00
2016-07-03 10:55:07 +02:00
2017-01-09 17:24:55 +01:00
2016-12-25 17:21:22 +01:00
2017-09-03 17:08:42 -07:00
2016-06-23 13:26:49 +02:00