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-11-02 15:26:02 -04:00
2016-12-24 11:46:01 -08:00
2015-07-31 15:21:30 -07:00
2016-12-03 23:21:37 -05:00
2015-12-22 15:57:54 -05:00
2016-12-24 11:46:01 -08:00
2016-11-04 14:45:23 -04:00
2015-03-31 13:51:54 -04:00
2016-08-13 14:56:17 -07:00
2016-12-24 11:46:01 -08:00
2016-12-03 12:29:53 -05:00
2016-06-27 15:06:15 -04:00
2015-09-02 15:31:00 -07:00
2016-12-25 17:21:22 +01:00
2016-09-10 23:12:51 -07:00
2016-05-29 22:24:21 -07:00
2016-12-24 11:46:01 -08:00
2016-12-17 11:13:19 -05:00
2016-10-29 12:01:49 -04:00
2016-06-14 15:26:42 -04:00
2016-09-09 16:50:23 -07:00
2016-12-24 11:46:01 -08:00
2016-11-18 10:59:15 -05:00
2016-06-18 22:11:38 -07:00
2016-06-08 00:25:38 -07:00
2017-01-10 21:30:33 -05:00
2016-04-07 16:53:29 -04:00
2016-12-29 11:55:17 -05:00
2016-12-24 11:46:01 -08:00
2016-11-02 15:18:36 -04:00
2017-01-06 16:09:09 -05:00
2016-12-24 11:46:01 -08:00
2016-11-04 14:45:23 -04:00
2016-12-24 11:46:01 -08:00
2016-11-16 11:29:46 -05:00
2016-11-16 11:29:46 -05:00
2015-08-13 17:08:39 -07:00
2016-10-21 11:29:02 -04:00
2016-12-25 17:21:23 +01:00
2016-12-03 23:21:37 -05:00
2016-11-04 14:45:23 -04:00
2016-12-02 12:34:22 -05:00
2016-11-04 14:45:23 -04:00
2016-09-30 01:50:44 -04:00
2014-09-19 17:15:31 -04:00
2016-12-23 12:20:39 -05:00
2016-11-03 15:41:11 -04:00
2017-01-12 15:11:43 -05:00
2017-01-13 12:29:55 -05:00
2017-01-13 12:29:55 -05:00
2016-11-16 11:29:46 -05:00
2016-12-24 11:46:01 -08:00
2016-12-02 12:49:59 -05:00
2016-06-27 15:06:17 -04:00
2016-12-05 13:32:24 -05:00
2015-02-28 16:56:51 -05:00
2015-11-03 10:52:13 -05:00
2016-11-24 15:32:14 -05:00
2016-05-20 18:03:15 -04:00
2016-12-24 11:46:01 -08:00
2016-11-24 15:32:14 -05:00
2016-09-21 10:09:14 +02:00
2015-03-31 13:58:35 -04:00
2013-12-06 12:37:56 -05:00
2016-01-15 15:07:23 -05:00
2015-10-24 06:54:12 -07:00
2016-09-12 15:52:44 -07:00
2014-05-06 07:08:38 +02:00
2014-08-24 22:37:52 -07:00
2016-11-18 10:59:15 -05:00