Files
tegra-linux-noble/include/linux
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-07-17 15:11:37 -04:00
2012-06-06 15:20:22 -04:00
2012-05-25 12:46:23 +05:30
2012-06-27 15:42:24 -07:00
2012-05-29 23:28:33 -04:00
2012-07-05 15:04:10 +02:00
2012-05-22 11:32:31 +02:00
2012-07-02 15:11:12 +02:00
2012-07-20 11:07:00 -07:00
2012-06-11 23:57:22 -07:00
2012-07-18 08:59:58 -07:00
2012-06-30 15:56:40 -07:00
2012-05-31 17:49:30 -07:00
2012-05-31 17:49:32 -07:00
2012-05-31 17:49:26 -07:00
2012-05-31 17:49:30 -07:00
2012-07-02 21:10:30 -03:00
2012-05-29 23:28:41 -04:00
2012-05-22 15:20:28 -04:00
2012-07-20 11:21:06 -07:00
2012-07-09 16:42:24 -04:00
2012-05-26 14:17:30 -04:00
2012-06-05 18:38:47 -04:00
2012-05-21 14:31:48 +01:00
2012-06-20 14:39:36 -07:00
2012-06-06 17:08:00 +02:00
2012-07-12 07:54:46 -07: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-16 22:31:34 -07:00
2012-06-13 21:16:42 +02:00
2012-05-21 16:16:58 -07:00
2012-05-22 12:16:16 +09:30