David Lebrun
fa79581ea6
ipv6: sr: fix several BUGs when preemption is enabled
When CONFIG_PREEMPT=y, CONFIG_IPV6=m and CONFIG_SEG6_HMAC=y,
seg6_hmac_init() is called during the initialization of the ipv6 module.
This causes a subsequent call to smp_processor_id() with preemption
enabled, resulting in the following trace.
[ 20.451460] BUG: using smp_processor_id() in preemptible [00000000] code: systemd/1
[ 20.452556] caller is debug_smp_processor_id+0x17/0x19
[ 20.453304] CPU: 0 PID: 1 Comm: systemd Not tainted 4.9.0-rc5-00973-g46738b1 #1
[ 20.454406] ffffc9000062fc18 ffffffff813607b2 0000000000000000 ffffffff81a7f782
[ 20.455528] ffffc9000062fc48 ffffffff813778dc 0000000000000000 00000000001dcf98
[ 20.456539] ffffffffa003bd08 ffffffff81af93e0 ffffc9000062fc58 ffffffff81377905
[ 20.456539] Call Trace:
[ 20.456539] [<ffffffff813607b2>] dump_stack+0x63/0x7f
[ 20.456539] [<ffffffff813778dc>] check_preemption_disabled+0xd1/0xe3
[ 20.456539] [<ffffffff81377905>] debug_smp_processor_id+0x17/0x19
[ 20.460260] [<ffffffffa0061f3b>] seg6_hmac_init+0xfa/0x192 [ipv6]
[ 20.460260] [<ffffffffa0061ccc>] seg6_init+0x39/0x6f [ipv6]
[ 20.460260] [<ffffffffa006121a>] inet6_init+0x21a/0x321 [ipv6]
[ 20.460260] [<ffffffffa0061000>] ? 0xffffffffa0061000
[ 20.460260] [<ffffffff81000457>] do_one_initcall+0x8b/0x115
[ 20.460260] [<ffffffff811328a3>] do_init_module+0x53/0x1c4
[ 20.460260] [<ffffffff8110650a>] load_module+0x1153/0x14ec
[ 20.460260] [<ffffffff81106a7b>] SYSC_finit_module+0x8c/0xb9
[ 20.460260] [<ffffffff81106a7b>] ? SYSC_finit_module+0x8c/0xb9
[ 20.460260] [<ffffffff81106abc>] SyS_finit_module+0x9/0xb
[ 20.460260] [<ffffffff810014d1>] do_syscall_64+0x62/0x75
[ 20.460260] [<ffffffff816834f0>] entry_SYSCALL64_slow_path+0x25/0x25
Moreover, dst_cache_* functions also call smp_processor_id(), generating
a similar trace.
This patch uses raw_cpu_ptr() in seg6_hmac_init() rather than this_cpu_ptr()
and disable preemption when using dst_cache_* functions.
Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-01-13 12:29:55 -05:00
..
2016-09-19 20:19:34 +02:00
2016-09-23 13:47:44 -04:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2016-09-10 21:19:10 -07:00
2016-12-28 15:11:32 -05:00
2016-12-24 11:46:01 -08:00
2016-12-06 21:33:19 -05:00
2016-12-16 10:24:44 -08:00
2017-01-05 11:49:57 -05:00
2016-12-06 21:33:19 -05:00
2016-12-25 17:21:22 +01:00
2016-12-14 22:39:08 +01:00
2017-01-11 11:15:15 -08:00
2016-12-03 23:54:25 -05:00
2016-12-03 12:29:53 -05:00
2016-12-24 11:46:01 -08:00
2016-04-11 22:37:37 +01:00
2017-01-10 20:18:52 -05:00
2016-11-07 20:15:55 -05:00
2016-10-30 12:42:58 -04:00
2016-12-16 00:13:43 +02:00
2017-01-12 15:18:20 -05:00
2017-01-13 12:29:55 -05:00
2016-12-25 17:21:22 +01:00
2016-12-24 11:46:01 -08:00
2017-01-10 21:08:29 -05:00
2016-10-07 15:36:58 -07:00
2016-11-18 10:59:15 -05:00
2017-01-01 22:07:20 -05:00
2016-09-10 23:12:53 -07:00
2016-12-24 11:46:01 -08:00
2016-11-14 13:17:21 -05:00
2017-01-02 11:28:25 +01:00
2016-12-25 17:21:22 +01:00
2016-12-06 21:33:19 -05:00
2016-10-20 11:23:08 -04:00
2017-01-05 11:49:57 -05:00
2017-01-06 22:20:45 -05:00
2016-12-24 11:46:01 -08:00
2016-10-27 16:16:09 -04:00
2016-12-27 12:28:07 -05:00
2016-12-24 11:46:01 -08:00
2016-11-18 10:59:15 -05:00
2017-01-10 20:45:04 -05:00
2016-12-20 14:22:49 -05:00
2016-04-05 10:48:53 +02:00
2016-12-24 11:46:01 -08:00
2016-12-14 16:04:10 -08:00
2016-12-28 14:28:13 -05:00
2017-01-11 10:01:01 -05:00
2016-10-12 01:51:49 -04:00
2016-12-25 17:21:22 +01:00
2016-10-30 12:42:58 -04:00
2016-12-23 17:53:47 -05:00
2016-12-24 11:46:01 -08:00
2016-12-17 20:17:04 -08:00
2016-10-27 16:16:09 -04:00
2017-01-05 10:59:53 +01:00
2016-12-24 11:46:01 -08:00
2016-12-25 17:21:22 +01:00
2016-12-24 11:46:01 -08:00
2017-01-11 09:47:10 -05:00
2016-08-17 19:36:23 -04:00
2017-01-10 11:29:50 -05:00
2016-10-06 09:52:23 -07:00