Mikulas Patocka
b09e786bd1
tun: fix a crash bug and a memory leak
...
This patch fixes a crash
tun_chr_close -> netdev_run_todo -> tun_free_netdev -> sk_release_kernel ->
sock_release -> iput(SOCK_INODE(sock))
introduced by commit 1ab5ecb90c
The problem is that this socket is embedded in struct tun_struct, it has
no inode, iput is called on invalid inode, which modifies invalid memory
and optionally causes a crash.
sock_release also decrements sockets_in_use, this causes a bug that
"sockets: used" field in /proc/*/net/sockstat keeps on decreasing when
creating and closing tun devices.
This patch introduces a flag SOCK_EXTERNALLY_ALLOCATED that instructs
sock_release to not free the inode and not decrement sockets_in_use,
fixing both memory corruption and sockets_in_use underflow.
It should be backported to 3.3 an 3.4 stabke.
Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz >
Cc: stable@kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net >
2012-07-20 11:21:06 -07:00
..
2012-05-25 09:31:59 -07:00
2012-07-17 15:11:37 -04:00
2012-07-20 12:31:05 +02:00
2012-05-30 11:17:19 -07:00
2012-05-24 10:34:29 -07:00
2012-05-29 11:53:11 -07:00
2012-07-19 08:34:37 -07:00
2012-06-20 14:41:57 -07:00
2012-06-01 16:55:42 -07:00
2012-07-04 19:51:50 +02:00
2012-06-07 14:58:38 +02:00
2012-05-31 18:18:11 -07:00
2012-05-23 14:15:09 -07:00
2012-05-22 13:54:18 +10:00
2012-05-29 16:22:33 -07:00
2012-06-28 17:37:00 -07:00
2012-06-06 15:20:22 -04:00
2012-05-31 20:29:58 -04:00
2012-06-28 17:37:00 -07:00
2012-07-05 01:33:59 -07:00
2012-05-29 16:22:29 -07:00
2012-06-15 08:46:23 +02:00
2012-07-11 16:04:49 -07:00
2012-05-29 16:22:20 -07:00
2012-07-04 13:07:05 +02:00
2012-07-17 21:37:27 +02:00
2012-05-25 01:44:51 +02:00
2012-06-03 20:05:57 -07:00
2012-05-31 17:49:32 -07:00
2012-06-18 09:47:00 -04:00
2012-07-19 08:34:37 -07:00
2012-05-31 17:49:29 -07:00
2012-05-31 17:49:28 -07:00
2012-07-18 18:15:46 -07:00
2012-05-25 12:46:23 +05:30
2012-05-21 15:09:37 +02:00
2012-05-31 17:49:31 -07:00
2012-05-28 19:13:50 -03:00
2012-06-01 12:12:01 -04:00
2012-07-16 22:38:27 -07:00
2012-06-27 15:42:24 -07:00
2012-05-31 17:49:32 -07:00
2012-07-17 21:37:27 +02:00
2012-05-29 23:28:33 -04:00
2012-06-01 16:57:51 -07:00
2012-05-21 20:27:36 -07:00
2012-05-24 12:57:47 -07:00
2012-06-03 14:50:19 -07:00
2012-05-30 21:04:53 -04:00
2012-05-29 22:33:56 -04:00
2012-05-21 15:09:33 +02:00
2012-07-05 15:04:10 +02:00
2012-05-22 11:32:31 +02:00
2012-07-11 23:34:39 +02:00
2012-05-29 16:22:21 -07:00
2012-05-25 12:48:26 -04:00
2012-05-22 16:02:13 -07:00
2012-06-04 16:49:43 +02:00
2012-05-30 10:55:34 +02:00
2012-07-02 15:11:12 +02:00
2012-05-22 17:13:11 -04:00
2012-06-19 21:39:50 +02:00
2012-07-20 11:07:00 -07:00
2012-07-20 11:07:00 -07:00
2012-07-18 09:36:12 -07:00
2012-06-30 01:08:00 -07:00
2012-06-12 15:25:46 -07:00
2012-05-30 14:02:25 +02:00
2012-06-11 23:57:22 -07:00
2012-05-23 22:11:12 -04:00
2012-05-22 18:08:08 +02:00
2012-05-31 17:49:31 -07:00
2012-07-18 08:59:58 -07:00
2012-05-23 13:49:23 -04:00
2012-06-30 15:56:40 -07:00
2012-05-27 08:12:42 -04:00
2012-05-29 16:22:32 -07:00
2012-05-31 17:49:30 -07:00
2012-05-31 17:49:32 -07:00
2012-05-29 16:22:21 -07:00
2012-05-31 17:49:26 -07:00
2012-05-31 17:49:30 -07:00
2012-05-23 22:11:31 -04:00
2012-05-31 17:49:28 -07:00
2012-06-18 15:55:21 -07:00
2012-06-04 11:43:00 -04:00
2012-07-02 21:10:30 -03:00
2012-05-29 16:22:29 -07:00
2012-05-29 16:22:32 -07:00
2012-05-29 16:22:31 -07:00
2012-05-29 23:28:41 -04:00
2012-07-01 03:34:50 -07:00
2012-07-11 16:04:50 -07:00
2012-05-29 16:22:28 -07:00
2012-05-29 16:22:20 -07:00
2012-05-22 15:20:28 -04:00
2012-07-01 03:34:50 -07:00
2012-05-29 16:22:28 -07:00
2012-06-20 14:39:35 -07:00
2012-06-01 10:34:35 -07:00
2012-05-29 16:22:20 -07:00
2012-07-11 16:04:41 -07:00
2012-06-08 14:58:13 +09:30
2012-05-31 17:49:27 -07:00
2012-07-20 11:21:06 -07:00
2012-07-20 11:06:59 -07:00
2012-06-16 15:40:02 +02:00
2012-06-16 15:40:02 +02:00
2012-06-22 02:49:52 +02:00
2012-06-29 16:46:06 -07:00
2012-07-17 09:02:36 -07:00
2012-07-09 16:42:24 -04:00
2012-05-26 14:17:30 -04:00
2012-06-18 08:45:16 -04:00
2012-05-24 16:15:48 -04:00
2012-06-05 18:38:47 -04:00
2012-07-17 12:16:39 +02:00
2012-06-26 21:06:11 -07:00
2012-05-21 14:31:48 +01:00
2012-05-29 16:22:24 -07:00
2012-05-21 15:09:33 +02:00
2012-05-29 16:22:18 -07:00
2012-06-20 14:39:36 -07:00
2012-07-10 09:52:05 -07:00
2012-06-06 17:08:00 +02:00
2012-07-09 00:10:56 -07:00
2012-07-12 07:54:46 -07:00
2012-07-08 00:25:48 +10:00
2012-06-13 16:52:40 -07:00
2012-06-11 12:26:15 +08:00
2012-06-05 10:46:40 -07:00
2012-07-02 11:39:19 -07:00
2012-07-02 11:39:19 -07:00
2012-06-06 20:43:28 -07:00
2012-05-29 16:22:27 -07:00
2012-05-31 17:49:31 -07:00
2012-05-31 17:49:31 -07:00
2012-05-29 16:22:21 -07:00
2012-07-04 11:51:59 +03:00
2012-05-29 16:22:33 -07:00
2012-07-10 22:40:13 -07:00
2012-07-14 11:16:24 -07:00
2012-06-01 10:37:01 -04:00
2012-05-23 17:12:06 -07:00
2012-05-22 19:07:55 +09:00
2012-06-01 12:58:52 -04:00
2012-06-15 15:30:15 -07:00
2012-05-31 17:49:26 -07:00
2012-07-19 11:02:03 -07:00
2012-07-16 22:31:34 -07:00
2012-07-19 11:02:03 -07:00
2012-06-13 21:16:42 +02:00
2012-06-04 12:28:45 -07:00
2012-06-15 21:48:14 -07:00
2012-05-31 17:49:32 -07:00
2012-06-22 23:02:22 -07:00
2012-05-23 22:09:21 -04:00
2012-07-20 10:59:41 -07:00
2012-06-01 12:58:50 -04:00
2012-05-21 16:16:58 -07:00
2012-07-13 19:34:43 -04:00
2012-05-22 18:27:32 -07:00
2012-05-23 22:11:31 -04:00
2012-06-02 15:21:43 -07:00
2012-05-30 21:04:50 -04:00
2012-05-21 09:00:03 -07:00
2012-06-21 09:32:16 +01:00
2012-06-11 15:47:21 -03:00
2012-05-22 12:16:16 +09:30
2012-05-30 07:55:31 +02:00