[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120720.112337.474955511809249636.davem@davemloft.net>
Date: Fri, 20 Jul 2012 11:23:37 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: mikulas@...ax.karlin.mff.cuni.cz
Cc: eric.dumazet@...il.com, maxk@...lcomm.com, vtun@...ice.satix.net,
netdev@...r.kernel.org
Subject: Re: [PATCH] Crash in tun
From: Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>
Date: Thu, 19 Jul 2012 18:13:36 +0200 (CEST)
> 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 1ab5ecb90cb6a3df1476e052f76a6e8f6511cb3d
>
> 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@...ax.karlin.mff.cuni.cz>
> Cc: stable@...nel.org
Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists