Michael S. Tsirkin 0110d6f22f tun: orphan an skb on tx
The following situation was observed in the field:
tap1 sends packets, tap2 does not consume them, as a result
tap1 can not be closed. This happens because
tun/tap devices can hang on to skbs undefinitely.

As noted by Herbert, possible solutions include a timeout followed by a
copy/change of ownership of the skb, or always copying/changing
ownership if we're going into a hostile device.

This patch implements the second approach.

Note: one issue still remaining is that since skbs
keep reference to tun socket and tun socket has a
reference to tun device, we won't flush backlog,
instead simply waiting for all skbs to get transmitted.
At least this is not user-triggerable, and
this was not reported in practice, my assumption is
other devices besides tap complete an skb
within finite time after it has been queued.

A possible solution for the second issue
would not to have socket reference the device,
instead, implement dev->destructor for tun, and
wait for all skbs to complete there, but this
needs some thought, probably too risky for 2.6.34.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Yan Vugenfirer <yvugenfi@redhat.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-14 04:52:03 -07:00
..
2009-09-01 01:13:50 -07:00
2010-02-18 14:47:48 -08:00
2009-04-04 16:51:14 -07:00
2010-02-16 15:19:03 -08:00
2009-08-12 23:03:00 -07:00
2010-02-17 13:35:44 -08:00
2010-02-17 13:35:44 -08:00
2010-02-17 13:35:44 -08:00
2009-11-05 20:00:29 -08:00
2010-03-03 01:04:39 -08:00
2010-02-26 02:10:14 -08:00
2010-02-26 02:10:14 -08:00
2010-02-26 02:10:14 -08:00
2010-03-07 15:25:53 -08:00
2009-11-11 19:22:21 -08:00
2010-03-26 20:16:23 -07:00
2009-11-20 15:35:04 -08:00
2010-03-18 21:14:00 -07:00
2009-10-13 11:48:18 -07:00
2009-10-20 19:11:06 -07:00
2010-01-28 06:01:35 -08:00
2010-03-16 14:15:42 -07:00
2010-01-18 00:29:19 -08:00
2010-04-01 19:33:04 -07:00
2009-04-29 17:32:34 -07:00
2009-10-01 15:14:54 -07:00
2010-02-12 16:21:01 -08:00
2009-03-27 00:46:48 -07:00
2010-02-26 02:08:42 -08:00
2010-02-17 17:27:40 -08:00
2010-04-14 04:52:03 -07:00
2009-11-26 15:51:29 -08:00
2010-04-12 22:00:34 -07:00