Eric Dumazet
e6c654c9c0
can: Fix kernel panic at security_sock_rcv_skb
...
[ Upstream commit f1712c73714088a7252d276a57126d56c7d37e64 ]
Zhang Yanmin reported crashes [1] and provided a patch adding a
synchronize_rcu() call in can_rx_unregister()
The main problem seems that the sockets themselves are not RCU
protected.
If CAN uses RCU for delivery, then sockets should be freed only after
one RCU grace period.
Recent kernels could use sock_set_flag(sk, SOCK_RCU_FREE), but let's
ease stable backports with the following fix instead.
[1]
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffff81495e25>] selinux_socket_sock_rcv_skb+0x65/0x2a0
Call Trace:
<IRQ>
[<ffffffff81485d8c>] security_sock_rcv_skb+0x4c/0x60
[<ffffffff81d55771>] sk_filter+0x41/0x210
[<ffffffff81d12913>] sock_queue_rcv_skb+0x53/0x3a0
[<ffffffff81f0a2b3>] raw_rcv+0x2a3/0x3c0
[<ffffffff81f06eab>] can_rcv_filter+0x12b/0x370
[<ffffffff81f07af9>] can_receive+0xd9/0x120
[<ffffffff81f07beb>] can_rcv+0xab/0x100
[<ffffffff81d362ac>] __netif_receive_skb_core+0xd8c/0x11f0
[<ffffffff81d36734>] __netif_receive_skb+0x24/0xb0
[<ffffffff81d37f67>] process_backlog+0x127/0x280
[<ffffffff81d36f7b>] net_rx_action+0x33b/0x4f0
[<ffffffff810c88d4>] __do_softirq+0x184/0x440
[<ffffffff81f9e86c>] do_softirq_own_stack+0x1c/0x30
<EOI>
[<ffffffff810c76fb>] do_softirq.part.18+0x3b/0x40
[<ffffffff810c8bed>] do_softirq+0x1d/0x20
[<ffffffff81d30085>] netif_rx_ni+0xe5/0x110
[<ffffffff8199cc87>] slcan_receive_buf+0x507/0x520
[<ffffffff8167ef7c>] flush_to_ldisc+0x21c/0x230
[<ffffffff810e3baf>] process_one_work+0x24f/0x670
[<ffffffff810e44ed>] worker_thread+0x9d/0x6f0
[<ffffffff810e4450>] ? rescuer_thread+0x480/0x480
[<ffffffff810ebafc>] kthread+0x12c/0x150
[<ffffffff81f9ccef>] ret_from_fork+0x3f/0x70
Reported-by: Zhang Yanmin <yanmin.zhang@intel.com >
Signed-off-by: Eric Dumazet <edumazet@google.com >
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net >
Signed-off-by: David S. Miller <davem@davemloft.net >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-02-18 16:39:26 +01:00
..
2015-10-19 17:08:32 +01:00
2016-08-10 11:49:24 +02:00
2017-02-18 16:39:26 +01:00
2016-03-03 15:07:26 -08:00
2015-10-01 12:48:11 -07:00
2015-10-17 21:22:08 -07:00
2015-09-30 19:22:50 +09:00
2015-10-07 18:08:15 +01:00
2015-10-21 18:05:50 -05:00
2015-10-16 22:11:16 +02:00
2015-10-20 18:10:25 +02:00
2015-08-27 20:47:09 +01:00
2015-09-27 17:33:59 -07:00
2016-10-28 03:01:34 -04:00
2015-10-23 15:57:27 -04:00
2016-10-16 17:36:14 +02:00
2015-12-08 12:42:44 -05:00
2016-08-20 18:09:25 +02:00
2016-09-24 10:07:42 +02:00
2016-01-05 16:00:03 -08:00
2016-06-24 10:18:24 -07:00
2015-09-18 21:57:43 +02:00
2015-09-18 21:57:35 +02:00
2015-09-18 21:57:43 +02:00
2015-09-18 21:57:43 +02:00
2015-07-31 15:01:14 +01:00
2015-10-27 11:24:23 +01:00
2016-04-12 09:08:32 -07:00
2015-09-23 17:15:27 +02:00
2015-12-07 14:14:03 -05:00
2015-10-16 17:57:33 +01:00
2015-09-23 09:51:25 +02:00
2015-11-10 15:00:03 -08:00
2015-11-10 14:48:36 -08:00
2017-02-01 08:30:53 +01:00
2016-07-27 09:47:28 -07:00
2016-09-07 08:32:45 +02:00
2015-09-17 10:09:37 -05:00
2015-08-05 13:38:07 +01:00
2016-03-09 15:34:52 -08:00
2015-10-06 12:33:14 +02:00
2015-11-03 17:22:17 -08:00
2015-11-04 08:23:51 -05:00
2015-08-20 14:10:23 -07:00
2016-08-20 18:09:24 +02:00
2016-08-20 18:09:24 +02:00
2016-08-20 18:09:24 +02:00
2015-08-05 09:38:08 +02:00
2015-12-09 10:35:16 -08:00
2015-11-11 09:37:34 -07:00
2015-10-27 15:04:56 +09:00
2015-11-07 10:40:47 -07:00
2016-09-15 08:27:47 +02:00
2015-09-29 13:37:04 -07:00
2016-07-11 09:31:11 -07:00
2015-10-08 04:45:52 -07:00
2015-11-11 02:19:33 -05:00
2017-01-12 11:22:50 +01:00
2015-09-10 18:56:14 -07:00
2016-05-04 14:48:49 -07:00
2015-12-03 10:18:21 -05:00
2016-05-11 11:21:11 +02:00
2015-09-14 11:00:55 +02:00
2015-10-01 02:18:39 +02:00
2015-10-23 17:55:10 +09:00
2015-11-05 19:34:48 -08:00
2016-12-08 07:15:24 +01:00
2016-02-25 12:01:16 -08:00
2015-11-20 16:17:32 -08:00
2016-02-17 12:30:57 -08:00
2015-11-10 12:06:23 +01:00
2015-10-07 17:54:09 +01:00
2015-10-15 00:21:07 +02:00
2016-12-15 08:49:23 -08:00
2015-12-02 23:50:33 +01:00
2015-08-28 15:14:54 +02:00
2017-02-14 15:22:51 -08:00
2016-05-04 14:48:49 -07:00
2017-01-12 11:22:50 +01:00
2015-08-17 16:53:53 +08:00
2015-09-08 15:35:28 -07:00
2016-07-27 09:47:33 -07:00
2015-10-09 07:49:02 -07:00
2015-10-18 10:14:39 -07:00
2015-11-02 13:14:44 -08:00
2016-10-28 03:01:26 -04:00
2015-09-11 14:23:29 +09:00
2016-04-12 09:08:39 -07:00
2015-10-09 17:00:33 -04:00
2016-08-16 09:30:49 +02:00
2015-10-15 13:22:35 +01:00
2015-10-23 17:55:10 +09:00
2015-10-15 16:41:04 +02:00
2015-11-06 17:50:42 -08:00
2015-10-04 12:46:06 +01:00
2015-09-08 15:35:28 -07:00
2015-11-18 16:27:46 -05:00
2015-11-04 21:50:37 -08:00
2016-03-03 15:07:09 -08:00
2015-12-11 11:05:57 -08:00
2015-08-17 12:14:53 -07:00
2015-10-16 08:30:09 +09:00
2015-08-21 22:45:13 -07:00
2015-10-04 11:36:07 +01:00
2015-11-10 09:33:06 -08:00
2015-10-31 16:12:10 -07:00
2015-10-30 01:47:27 -04:00
2016-11-21 10:06:40 +01:00
2016-10-22 12:26:56 +02:00
2015-08-14 16:50:36 -07:00
2015-08-07 22:59:34 -05:00
2016-09-30 10:18:37 +02:00
2016-01-07 12:17:39 -05:00
2015-11-04 18:10:13 -08:00
2015-09-04 16:54:41 -07:00
2015-10-09 07:48:59 -07:00
2015-10-21 14:43:42 -06:00
2015-11-20 16:17:32 -08:00
2016-05-11 11:21:13 +02:00
2015-11-05 09:51:50 -08:00
2015-11-09 15:11:24 -08:00
2016-02-17 12:30:57 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2016-03-03 15:07:16 -08:00
2015-10-20 17:47:45 +02:00
2015-08-24 14:05:19 +02:00
2016-09-07 08:32:44 +02:00
2015-10-13 10:34:46 +02:00
2015-09-24 20:42:37 +02:00
2016-04-20 15:42:02 +09:00
2015-10-23 05:44:28 -07:00
2015-09-29 16:27:47 -07:00
2015-10-09 07:49:05 -07:00
2015-11-05 14:51:32 -08:00
2015-10-13 23:30:31 -07:00
2016-12-02 09:09:00 +01:00
2015-10-27 08:36:08 +09:00
2015-09-22 12:39:57 +02:00
2015-10-15 00:21:07 +02:00
2015-10-15 00:21:07 +02:00
2015-08-10 23:07:05 -04:00
2015-08-27 19:40:58 -04:00
2015-11-04 11:30:57 -08:00
2015-10-22 00:00:49 +02:00
2015-10-16 22:18:51 +02:00
2015-10-04 12:46:06 +01:00
2015-09-03 15:02:28 -05:00
2015-12-02 23:37:16 -05:00
2016-09-24 10:07:43 +02:00
2015-10-01 15:06:43 +02:00
2015-10-01 02:18:38 +02:00
2015-09-16 15:47:51 +02:00
2015-10-13 19:01:25 +02:00
2015-09-16 15:47:51 +02:00
2015-10-30 10:13:26 +01:00
2015-10-18 17:02:56 -04:00
2015-09-01 14:04:50 -07:00
2017-01-19 20:17:19 +01:00
2016-07-27 09:47:29 -07:00
2015-08-22 14:54:55 +02:00
2015-11-09 15:11:24 -08:00
2016-10-28 03:01:30 -04:00
2015-08-18 15:49:15 -07:00
2015-09-10 13:29:01 -07:00
2015-10-21 15:18:36 +01:00
2015-10-21 15:18:36 +01:00
2015-12-12 10:15:34 -08:00
2015-09-10 13:29:01 -07:00
2015-10-04 11:46:16 +01:00
2015-08-04 10:16:54 +02:00
2015-11-28 19:33:29 -08:00
2015-09-04 16:54:41 -07:00
2015-11-19 14:25:32 +01:00
2015-10-01 15:06:46 +02:00
2015-10-26 09:10:56 +01:00
2016-03-09 15:34:52 -08:00
2015-08-28 23:40:05 -04:00
2016-10-28 03:01:32 -04:00
2015-10-06 11:16:42 -07:00
2015-10-06 11:16:42 -07:00
2015-10-06 11:16:42 -07:00
2015-08-12 11:59:08 +02:00
2015-11-23 09:44:58 +01:00
2015-08-10 14:29:27 +05:30
2015-11-17 15:25:43 -05:00
2015-11-10 12:06:16 +01:00
2015-09-20 19:31:10 -07:00
2015-11-05 19:34:48 -08:00
2016-08-16 09:30:51 +02:00
2017-02-09 08:02:47 +01:00
2015-10-04 12:46:06 +01:00
2015-09-09 17:19:14 -07:00
2015-10-27 18:55:31 -07:00
2017-01-06 11:16:11 +01:00
2016-10-20 10:00:47 +02:00
2015-12-18 14:25:40 -08:00
2015-09-10 13:29:01 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 11:04:07 -08:00
2016-03-09 15:34:56 -08:00
2015-11-06 17:50:42 -08:00
2015-10-20 22:10:45 +08:00
2016-11-15 07:46:37 +01:00
2016-11-15 07:46:37 +01:00
2016-09-07 08:32:38 +02:00
2015-10-17 21:11:29 -07:00
2016-07-11 09:31:11 -07:00
2015-11-03 11:29:57 -05:00
2017-01-15 13:41:35 +01:00
2015-09-17 17:18:37 -07:00
2015-11-06 19:33:12 +01:00
2015-09-29 20:21:32 +02:00
2015-09-30 01:45:03 -05:00
2015-10-16 18:45:36 +02:00
2015-09-09 21:43:22 -07:00
2017-02-01 08:30:53 +01:00
2015-10-15 16:08:18 -04:00
2016-03-03 15:07:28 -08:00
2015-11-23 21:57:44 -05:00
2015-11-05 19:34:48 -08:00
2015-09-07 15:17:08 -04:00
2015-09-07 15:17:09 -04:00
2015-10-09 10:40:37 -06:00
2016-10-07 15:23:41 +02:00
2015-08-05 13:43:12 -07:00
2015-11-10 17:27:12 -06:00
2015-11-16 09:03:21 +05:30
2015-10-16 22:49:26 +02:00
2015-12-09 09:23:28 -06:00
2015-11-12 11:50:33 -08:00
2015-08-25 11:29:55 -05:00
2015-11-10 17:27:12 -06:00
2015-09-01 09:59:20 +10:00
2015-10-28 10:05:58 -07:00
2015-10-08 05:26:36 -07:00
2015-09-08 15:35:28 -07:00
2015-11-05 19:34:48 -08:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-11-06 17:50:42 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2016-09-30 10:18:37 +02:00
2016-09-07 08:32:37 +02:00
2015-10-16 22:18:51 +02:00
2015-08-13 15:59:58 -05:00
2016-12-08 07:15:24 +01:00
2017-02-09 08:02:46 +01:00
2015-10-06 11:25:31 -07:00
2016-09-15 08:27:46 +02:00
2015-08-31 14:48:02 -07:00
2015-10-23 05:57:43 -07:00
2016-06-07 18:14:35 -07:00
2015-10-05 05:02:40 +01:00
2015-10-28 04:33:04 +01:00
2015-09-15 02:03:16 +02:00
2015-10-14 02:17:34 +02:00
2015-10-09 17:00:32 -04:00
2015-09-10 13:29:01 -07:00
2016-10-31 04:13:58 -06:00
2015-10-01 09:59:16 -07:00
2015-10-21 14:46:56 -06:00
2015-10-06 17:08:19 +02:00
2015-09-10 13:29:01 -07:00
2015-11-07 01:29:22 +01:00
2015-11-23 09:44:58 +01:00
2015-10-02 14:35:16 +01:00
2015-10-22 08:59:18 -07:00
2015-11-03 11:08:22 -05:00
2017-01-06 11:16:11 +01:00
2016-11-10 16:36:37 +01:00
2015-10-30 11:18:05 +09:00
2015-10-14 14:51:22 -05:00
2016-02-25 12:01:23 -08:00
2015-10-08 05:26:38 -07:00
2015-11-06 17:50:42 -08:00
2015-10-06 11:25:45 -07:00
2015-10-06 11:16:18 -07:00
2015-10-06 11:16:31 -07:00
2015-10-06 11:08:23 -07:00
2015-10-06 11:08:05 -07:00
2015-10-12 19:25:07 +01:00
2015-09-01 09:56:58 +02:00
2015-12-04 14:38:26 -05:00
2015-11-02 14:23:38 -05:00
2016-02-25 12:01:21 -08:00
2015-10-16 15:32:18 -07:00
2015-10-09 07:49:06 -07:00
2015-08-24 14:28:01 -06:00
2017-01-06 11:16:11 +01:00
2015-10-04 12:54:54 +01:00
2015-11-19 16:22:43 +01:00
2015-10-27 19:55:13 -07:00
2015-09-20 17:00:26 -07:00
2016-10-28 03:01:32 -04:00
2015-09-11 15:21:34 -07:00
2016-09-07 08:32:44 +02:00
2015-08-05 08:48:00 +05:30
2016-03-03 15:07:23 -08:00
2016-06-01 12:15:54 -07:00
2016-07-27 09:47:31 -07:00
2015-11-22 11:58:44 -08:00
2016-09-30 10:18:37 +02:00
2015-10-20 10:23:55 +02:00
2016-07-11 09:31:11 -07:00
2015-09-01 08:40:25 -07:00
2015-09-20 19:32:02 -07:00
2015-10-06 11:15:43 -07:00
2015-10-04 20:28:58 +01:00
2015-12-12 10:15:34 -08:00
2015-09-10 13:29:01 -07:00
2016-10-28 03:01:30 -04:00
2015-10-26 10:11:58 +09:00
2015-10-14 02:17:33 +02:00
2016-10-28 03:01:34 -04:00
2015-09-08 15:35:28 -07:00
2015-11-25 15:49:13 +00:00
2016-10-07 15:23:46 +02:00
2015-11-13 21:53:18 -08:00
2015-10-21 14:42:38 -06:00
2017-02-04 09:45:08 +01:00
2016-04-12 09:08:35 -07:00
2015-09-20 22:52:13 -07:00
2015-09-02 10:33:22 +02:00
2015-08-17 11:25:28 -07:00
2016-09-15 08:27:47 +02:00
2015-10-01 09:59:01 -07:00
2015-10-01 09:57:59 -07:00
2015-10-19 01:01:21 +02:00
2016-03-09 15:34:52 -08:00
2015-11-05 19:34:48 -08:00
2016-03-16 08:42:58 -07:00
2015-08-03 15:24:43 -07:00
2016-06-01 12:15:52 -07:00
2015-11-25 15:49:13 +00:00
2015-11-05 19:34:48 -08:00
2016-03-03 15:07:08 -08:00
2016-12-10 19:07:25 +01:00
2015-11-23 09:44:58 +01:00
2016-04-20 15:42:07 +09:00
2016-06-01 12:15:51 -07:00
2015-09-04 16:54:41 -07:00
2015-08-12 17:01:01 +01:00
2015-12-04 08:38:42 -07:00
2015-11-05 11:07:36 +10:00
2015-11-05 19:34:48 -08:00
2015-11-01 17:09:15 -08:00
2015-10-17 22:03:00 -07:00
2015-12-29 17:45:49 -08:00
2015-12-13 14:30:59 -08:00
2015-11-03 20:46:26 +01:00
2015-08-17 15:48:24 -04:00
2016-03-09 15:34:52 -08:00
2015-11-13 20:34:33 -05:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00