Eric Dumazet
d654976cbf
tcp: fix a potential deadlock in tcp_get_info()
...
Taking socket spinlock in tcp_get_info() can deadlock, as
inet_diag_dump_icsk() holds the &hashinfo->ehash_locks[i],
while packet processing can use the reverse locking order.
We could avoid this locking for TCP_LISTEN states, but lockdep would
certainly get confused as all TCP sockets share same lockdep classes.
[ 523.722504] ======================================================
[ 523.728706] [ INFO: possible circular locking dependency detected ]
[ 523.734990] 4.1.0-dbg-DEV #1676 Not tainted
[ 523.739202] -------------------------------------------------------
[ 523.745474] ss/18032 is trying to acquire lock:
[ 523.750002] (slock-AF_INET){+.-...}, at: [<ffffffff81669d44>] tcp_get_info+0x2c4/0x360
[ 523.758129]
[ 523.758129] but task is already holding lock:
[ 523.763968] (&(&hashinfo->ehash_locks[i])->rlock){+.-...}, at: [<ffffffff816bcb75>] inet_diag_dump_icsk+0x1d5/0x6c0
[ 523.774661]
[ 523.774661] which lock already depends on the new lock.
[ 523.774661]
[ 523.782850]
[ 523.782850] the existing dependency chain (in reverse order) is:
[ 523.790326]
-> #1 (&(&hashinfo->ehash_locks[i])->rlock){+.-...}:
[ 523.796599] [<ffffffff811126bb>] lock_acquire+0xbb/0x270
[ 523.802565] [<ffffffff816f5868>] _raw_spin_lock+0x38/0x50
[ 523.808628] [<ffffffff81665af8>] __inet_hash_nolisten+0x78/0x110
[ 523.815273] [<ffffffff816819db>] tcp_v4_syn_recv_sock+0x24b/0x350
[ 523.822067] [<ffffffff81684d41>] tcp_check_req+0x3c1/0x500
[ 523.828199] [<ffffffff81682d09>] tcp_v4_do_rcv+0x239/0x3d0
[ 523.834331] [<ffffffff816842fe>] tcp_v4_rcv+0xa8e/0xc10
[ 523.840202] [<ffffffff81658fa3>] ip_local_deliver_finish+0x133/0x3e0
[ 523.847214] [<ffffffff81659a9a>] ip_local_deliver+0xaa/0xc0
[ 523.853440] [<ffffffff816593b8>] ip_rcv_finish+0x168/0x5c0
[ 523.859624] [<ffffffff81659db7>] ip_rcv+0x307/0x420
Lets use u64_sync infrastructure instead. As a bonus, 64bit
arches get optimized, as these are nop for them.
Fixes: 0df48c26d8 ("tcp: add tcpi_bytes_acked to tcp_info")
Signed-off-by: Eric Dumazet <edumazet@google.com >
Signed-off-by: David S. Miller <davem@davemloft.net >
2015-05-22 13:46:06 -04:00
..
2015-03-17 16:23:21 +05:30
2015-03-13 16:25:50 +02:00
2015-03-22 23:50:11 +01:00
2015-04-22 18:33:48 +03:00
2015-04-22 09:24:55 -07:00
2015-04-22 18:33:43 +03:00
2015-04-24 09:49:37 -07:00
2015-03-19 09:45:54 +01:00
2015-02-27 14:56:57 -07:00
2015-03-29 16:17:10 +01:00
2015-05-09 14:59:05 -07:00
2015-04-26 13:36:02 -07:00
2015-04-15 15:51:50 -04:00
2015-04-02 16:33:43 -04:00
2015-04-24 09:49:37 -07:00
2015-03-27 10:37:38 -07:00
2015-03-31 13:58:35 -04:00
2015-04-04 13:26:52 -04:00
2015-04-13 20:08:38 +02:00
2015-04-04 12:47:04 -04:00
2015-04-04 12:52:06 -04:00
2015-03-05 10:08:14 +01:00
2015-04-24 09:49:37 -07:00
2015-04-06 17:46:27 +02:00
2015-04-22 08:00:41 +10:00
2015-04-10 19:16:03 +01:00
2015-04-15 09:00:47 -07:00
2015-04-23 15:16:37 -04:00
2015-04-07 11:17:34 +02:00
2015-03-18 17:27:03 +01:00
2015-04-15 16:35:22 -07:00
2015-03-26 15:13:07 +00:00
2015-04-24 08:23:45 -07:00
2015-03-25 20:28:11 -04:00
2015-03-27 13:44:43 +00:00
2015-04-22 08:00:42 +10:00
2015-03-27 11:59:22 -04:00
2015-04-01 17:22:00 +02:00
2015-04-17 09:03:56 -04:00
2015-04-17 09:03:53 -04:00
2015-05-04 13:09:55 -06:00
2015-04-17 08:31:12 -06:00
2015-04-02 13:25:49 +02:00
2015-04-14 15:44:14 -04:00
2015-04-15 16:35:22 -07:00
2015-04-14 16:49:03 -07:00
2015-04-10 17:45:30 -07:00
2015-03-11 15:56:59 -07:00
2015-04-03 08:44:37 +02:00
2015-04-24 08:23:45 -07:00
2015-04-14 16:49:04 -07:00
2015-04-15 16:35:17 -07:00
2015-05-04 17:49:51 +08:00
2015-05-04 17:49:51 +08:00
2015-05-04 17:49:51 +08:00
2015-03-26 16:16:20 +01:00
2015-03-09 15:43:03 +01:00
2015-03-09 15:43:03 +01:00
2015-04-13 10:19:30 +02:00
2015-04-03 13:15:50 +02:00
2015-04-16 12:33:51 +09:30
2015-04-15 16:35:22 -07:00
2015-03-31 21:21:03 +08:00
2015-04-15 15:05:28 -04:00
2015-03-23 16:52:26 -04:00
2015-03-30 17:09:41 +09:00
2015-03-31 12:03:49 -04:00
2015-04-14 20:21:54 -07:00
2015-04-21 14:47:16 +05:30
2015-03-09 13:05:47 +01:00
2015-03-16 22:28:15 +05:30
2015-04-17 23:18:53 +05:30
2015-04-01 12:46:22 +01:00
2015-04-14 16:49:05 -07:00
2015-03-02 16:43:41 -05:00
2015-04-10 15:08:57 -07:00
2015-03-25 15:07:05 +11:00
2015-03-24 15:25:15 -04:00
2015-03-02 14:50:06 -03:00
2015-04-09 11:39:55 -05:00
2015-04-26 17:22:07 -07:00
2015-05-06 23:03:23 -04:00
2015-04-03 23:23:51 +02:00
2015-04-14 16:49:04 -07:00
2015-04-13 23:43:34 +02:00
2015-02-23 15:11:52 +01:00
2015-04-14 09:25:26 -07:00
2015-04-02 18:46:20 +02:00
2015-04-15 16:35:19 -07:00
2015-03-16 21:45:54 +11:00
2015-04-03 16:18:02 +02:00
2015-04-14 20:21:54 -07:00
2015-03-14 17:11:30 +01:00
2015-03-05 14:52:23 -05:00
2015-04-10 21:57:22 -07:00
2015-03-02 00:17:31 -05:00
2015-03-29 13:33:22 -07:00
2015-03-18 22:05:09 -04:00
2015-03-10 13:45:28 -04:00
2015-03-05 09:23:12 +01:00
2015-03-25 15:43:39 +00:00
2015-04-08 23:28:28 +02:00
2015-04-21 09:42:58 -07:00
2015-04-18 12:32:59 -07:00
2015-03-31 15:32:16 +02:00
2015-04-15 16:35:22 -07:00
2015-03-23 22:12:08 -04:00
2015-03-23 10:55:21 +01:00
2015-04-11 11:17:28 +02:00
2015-03-04 21:42:19 +01:00
2015-04-03 12:52:29 -04:00
2015-04-09 09:40:24 +02:00
2015-03-26 23:51:36 +01:00
2015-04-15 16:35:20 -07:00
2015-04-21 09:44:55 -03:00
2015-04-17 09:03:55 -04:00
2015-04-23 16:52:01 +02:00
2015-04-15 16:35:17 -07:00
2015-04-14 13:58:48 -07:00
2015-03-31 09:45:50 -06:00
2015-03-30 11:55:48 -07:00
2015-03-09 17:16:23 -07:00
2015-03-24 11:52:08 +10:30
2015-04-25 16:50:14 -04:00
2015-03-03 11:16:00 -08:00
2015-04-14 16:49:06 -07:00
2015-04-14 16:49:00 -07:00
2015-04-15 16:35:18 -07:00
2015-04-14 16:49:05 -07:00
2015-03-25 11:44:52 +01:00
2015-04-17 09:04:07 -04:00
2015-04-22 09:44:36 -07:00
2015-04-15 16:35:16 -07:00
2015-03-31 12:04:12 +02:00
2015-04-14 10:49:03 -07:00
2015-03-12 18:46:08 -07:00
2015-04-18 11:20:31 -04:00
2015-04-11 15:27:37 -04:00
2015-05-12 23:22:03 -04:00
2015-04-24 20:51:40 +02:00
2015-04-07 15:25:55 -04:00
2015-04-13 16:35:16 -04:00
2015-04-21 16:16:04 -04:00
2015-04-26 17:33:59 -07:00
2015-04-23 14:36:28 -04:00
2015-05-05 17:10:11 -07:00
2015-04-14 16:48:59 -07:00
2015-04-07 19:11:06 -06:00
2015-03-03 14:42:56 -06:00
2015-04-14 19:35:44 -05:00
2015-03-26 12:14:56 -05:00
2015-03-03 14:42:55 -06:00
2015-04-14 19:23:24 -05:00
2015-03-11 17:56:28 -04:00
2015-03-09 23:50:20 -04:00
2015-03-03 14:42:57 -06:00
2015-03-13 09:45:24 -05:00
2015-04-24 08:46:18 -07:00
2015-03-06 12:39:48 +02:00
2015-04-14 16:49:05 -07:00
2015-04-15 16:35:19 -07:00
2015-05-06 10:47:25 -07:00
2015-04-08 16:25:25 -05:00
2015-04-09 14:20:11 -05:00
2015-04-16 13:53:32 -05:00
2015-04-02 17:14:17 +02:00
2015-04-12 21:03:31 +02:00
2015-04-03 15:08:20 -04:00
2015-03-16 23:49:03 +01:00
2015-03-22 22:19:12 +01:00
2015-03-18 15:54:27 +01:00
2015-03-22 22:14:12 +01:00
2015-03-18 22:39:16 +01:00
2015-03-13 23:15:52 +01:00
2015-04-15 16:35:23 -07:00
2015-04-03 23:23:51 +02:00
2015-03-23 14:06:10 +11:00
2015-03-31 12:01:19 -04:00
2015-03-11 15:15:11 -05:00
2015-03-18 21:55:08 +01:00
2015-03-16 10:26:41 +01:00
2015-03-20 08:31:01 -07:00
2015-04-15 16:35:23 -07:00
2015-03-12 10:43:26 +02:00
2015-05-16 18:08:26 -04:00
2015-04-15 16:35:19 -07:00
2015-04-03 08:18:24 +02:00
2015-04-29 14:59:16 -04:00
2015-04-27 15:49:30 +02:00
2015-04-15 09:00:47 -07:00
2015-02-24 08:44:16 +01:00
2015-03-26 18:18:20 +01:00
2015-04-10 14:39:53 +02:00
2015-02-23 16:12:24 +05:30
2015-04-25 15:49:49 -04:00
2015-04-14 16:48:59 -07:00
2015-04-20 09:08:49 -07:00
2015-03-06 23:07:20 +01:00
2015-03-11 21:55:28 -04:00
2015-04-11 15:53:35 -04:00
2015-03-03 11:16:47 -08:00
2015-04-14 09:50:27 -07:00
2015-03-17 09:25:28 +01:00
2015-04-16 13:58:42 -04:00
2015-04-16 19:02:04 -04:00
2015-04-15 16:35:17 -07:00
2015-04-17 09:04:07 -04:00
2015-03-25 13:28:58 +01:00
2015-05-22 13:46:06 -04:00
2015-02-24 14:40:42 -04:00
2015-04-03 08:44:37 +02:00
2015-03-27 09:45:07 +01:00
2015-04-03 08:18:34 +02:00
2015-04-08 09:39:56 -04:00
2015-04-28 14:26:20 +02:00
2015-04-15 16:35:22 -07:00
2015-03-18 22:00:34 -04:00
2015-04-15 16:35:22 -07:00
2015-04-11 22:29:44 -04:00
2015-04-28 12:48:57 +02:00
2015-04-07 12:58:35 -05:00
2015-05-05 17:10:11 -07:00
2015-04-14 18:06:47 -07:00
2015-04-07 11:14:38 -06:00
2015-04-01 14:37:14 +10:30
2015-04-13 21:04:16 +09:30
2015-04-15 12:41:14 +09:30
2015-03-12 18:46:08 -07:00
2015-03-06 17:03:22 -08:00
2015-04-02 17:33:15 +02:00
2015-03-24 09:48:14 -07:00
2015-03-09 09:22:28 -04:00
2015-03-17 12:23:32 -04:00
2015-04-15 16:35:20 -07:00