<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/net/tun.c, branch linux-2.6.30.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.30.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.30.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2009-07-20T03:38:47Z</updated>
<entry>
<title>tun/tap: Fix crashes if open() /dev/net/tun and then poll() it. (CVE-2009-1897)</title>
<updated>2009-07-20T03:38:47Z</updated>
<author>
<name>Mariusz Kozlowski</name>
</author>
<published>2009-07-05T19:48:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3f8fd3f9f677ce452556aca82473b7fcac370830'/>
<id>urn:sha1:3f8fd3f9f677ce452556aca82473b7fcac370830</id>
<content type='text'>
commit 3c8a9c63d5fd738c261bd0ceece04d9c8357ca13 upstream.

Fix NULL pointer dereference in tun_chr_pool() introduced by commit
33dccbb050bbe35b88ca8cf1228dcf3e4d4b3554 ("tun: Limit amount of queued
packets per device") and triggered by this code:

	int fd;
	struct pollfd pfd;
	fd = open("/dev/net/tun", O_RDWR);
	pfd.fd = fd;
	pfd.events = POLLIN | POLLOUT;
	poll(&amp;pfd, 1, 0);

Reported-by: Eugene Kapun &lt;abacabadabacaba@gmail.com&gt;
Signed-off-by: Mariusz Kozlowski &lt;m.kozlowski@tuxland.pl&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>tun: Fix unregister race</title>
<updated>2009-07-02T23:49:42Z</updated>
<author>
<name>Eric W. Biederman</name>
</author>
<published>2009-06-08T07:44:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=71d1ad90a58e00cf8aebd0e6c579c105d2ecb697'/>
<id>urn:sha1:71d1ad90a58e00cf8aebd0e6c579c105d2ecb697</id>
<content type='text'>
[ Upstream commit f0a4d0e5b5bfd271e6737f7c095994835b70d450 ]

It is possible for tun_chr_close to race with dellink on the
a tun device.  In which case if __tun_get runs before dellink
but dellink runs before tun_chr_close calls unregister_netdevice
we will attempt to unregister the netdevice after it is already
gone.

The two cases are already serialized on the rtnl_lock, so I have
gone for the cheap simple fix of moving rtnl_lock to cover __tun_get
in tun_chr_close.  Eliminating the possibility of the tun device
being unregistered between __tun_get and unregister_netdevice in
tun_chr_close.

Signed-off-by: Eric W. Biederman &lt;ebiederm@aristanetworks.com&gt;
Tested-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>tun: Fix sk_sleep races when attaching/detaching</title>
<updated>2009-04-20T10:01:48Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2009-04-19T22:35:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c40af84a6726f63e35740d26f841992e8f31f92c'/>
<id>urn:sha1:c40af84a6726f63e35740d26f841992e8f31f92c</id>
<content type='text'>
As the sk_sleep wait queue actually lives in tfile, which may be
detached from the tun device, bad things will happen when we use
sk_sleep after detaching.

Since the tun device is the persistent data structure here (when
requested by the user), it makes much more sense to have the wait
queue live there.  There is no reason to have it in tfile at all
since the only time we can wait is if we have a tun attached.
In fact we already have a wait queue in tun_struct, so we might
as well use it.

Reported-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Tested-by: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Tested-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: Only free a netdev when all tun descriptors are closed</title>
<updated>2009-04-20T10:01:47Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2009-04-18T14:15:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c3fea6ab04a7bd9298e635bf29b4a5379f6c476'/>
<id>urn:sha1:9c3fea6ab04a7bd9298e635bf29b4a5379f6c476</id>
<content type='text'>
The commit c70f182940f988448f3c12a209d18b1edc276e33 ("tun: Fix
races between tun_net_close and free_netdev") fixed a race where
an asynchronous deletion of a tun device can hose a poll(2) on
a tun fd attached to that device.

However, this came at the cost of moving the tun wait queue into
the tun file data structure.  The problem with this is that it
imposes restrictions on when and where the tun device can access
the wait queue since the tun file may change at any time due to
detaching and reattaching.

In particular, now that we need to use the wait queue on the
receive path it becomes difficult to properly synchronise this
with the detachment of the tun device.

This patch solves the original race in a different way.  Since
the race is only because the underlying memory gets freed, we
can prevent it simply by ensuring that we don't do that until
all tun descriptors ever attached to the device (even if they
have since be detached because they may still be sitting in poll)
have been closed.

This is done by using reference counting the attached tun file
descriptors.  The refcount in tun-&gt;sk has been reappropriated
for this purpose since it was already being used for that, albeit
from the opposite angle.

Note that we no longer zero tfile-&gt;tun since tun_get will return
NULL anyway after the refcount on tfile hits zero.  Instead it
represents whether this device has ever been attached to a device.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: Fix crash with non-GSO users</title>
<updated>2009-04-14T09:09:43Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2009-04-14T09:09:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0eca93bcf73e5939053a94f7c48f8d6fe6199e00'/>
<id>urn:sha1:0eca93bcf73e5939053a94f7c48f8d6fe6199e00</id>
<content type='text'>
When I made the tun driver use non-linear packets as the preferred
option, it broke non-GSO users because they would end up allocating
a completely non-linear packet, which triggers a crash when we call
eth_type_trans.

This patch reverts non-GSO users to using linear packets and adds
a check to ensure that GSO users can't cause crashes in the same
way.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: Fix merge error</title>
<updated>2009-02-15T04:46:39Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2009-02-15T04:46:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ab46d779661d7a03b7aa00279eead5dc3f0b3901'/>
<id>urn:sha1:ab46d779661d7a03b7aa00279eead5dc3f0b3901</id>
<content type='text'>
When forward-porting the tun accounting patch I managed to break
the send path compltely by dropping the tun_get call.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6</title>
<updated>2009-02-10T07:22:21Z</updated>
<author>
<name>David S. Miller</name>
</author>
<published>2009-02-10T07:22:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0ecc103aec454288cbaa5a33d8960ab3467e8a11'/>
<id>urn:sha1:0ecc103aec454288cbaa5a33d8960ab3467e8a11</id>
<content type='text'>
Conflicts:
	drivers/net/gianfar.c
</content>
</entry>
<entry>
<title>tun: Fix unicast filter overflow</title>
<updated>2009-02-09T01:49:17Z</updated>
<author>
<name>Alex Williamson</name>
</author>
<published>2009-02-09T01:49:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cfbf84fcbcda98bb91ada683a8dc8e6901a83ebd'/>
<id>urn:sha1:cfbf84fcbcda98bb91ada683a8dc8e6901a83ebd</id>
<content type='text'>
Tap devices can make use of a small MAC filter set via the
TUNSETTXFILTER ioctl.  The filter has a set of exact matches
plus a hash for imperfect filtering of additional multicast
addresses.  The current code is unbalanced, adding unicast
addresses to the multicast hash, but only checking the hash
against multicast addresses.  This results in the filter
dropping unicast addresses that overflow the exact filter.
The fix is simply to disable the filter by leaving count set
to zero if we find non-multicast addresses after the exact
match table is filled.

Signed-off-by: Alex Williamson &lt;alex.williamson@hp.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: Limit amount of queued packets per device</title>
<updated>2009-02-06T05:25:32Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2009-02-06T05:25:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=33dccbb050bbe35b88ca8cf1228dcf3e4d4b3554'/>
<id>urn:sha1:33dccbb050bbe35b88ca8cf1228dcf3e4d4b3554</id>
<content type='text'>
Unlike a normal socket path, the tuntap device send path does
not have any accounting.  This means that the user-space sender
may be able to pin down arbitrary amounts of kernel memory by
continuing to send data to an end-point that is congested.

Even when this isn't an issue because of limited queueing at
most end points, this can also be a problem because its only
response to congestion is packet loss.  That is, when those
local queues at the end-point fills up, the tuntap device will
start wasting system time because it will continue to send
data there which simply gets dropped straight away.

Of course one could argue that everybody should do congestion
control end-to-end, unfortunately there are people in this world
still hooked on UDP, and they don't appear to be going away
anywhere fast.  In fact, we've always helped them by performing
accounting in our UDP code, the sole purpose of which is to
provide congestion feedback other than through packet loss.

This patch attempts to apply the same bandaid to the tuntap device.
It creates a pseudo-socket object which is used to account our
packets just as a normal socket does for UDP.  Of course things
are a little complex because we're actually reinjecting traffic
back into the stack rather than out of the stack.

The stack complexities however should have been resolved by preceding
patches.  So this one can simply start using skb_set_owner_w.

For now the accounting is essentially disabled by default for
backwards compatibility.  In particular, we set the cap to INT_MAX.
This is so that existing applications don't get confused by the
sudden arrival EAGAIN errors.

In future we may wish (or be forced to) do this by default.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>tun: Check supplemental groups in TUN/TAP driver.</title>
<updated>2009-02-03T07:34:56Z</updated>
<author>
<name>Michael Tokarev</name>
</author>
<published>2009-02-03T07:34:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1bded710a574f20d41bc9e7fb531301db282d623'/>
<id>urn:sha1:1bded710a574f20d41bc9e7fb531301db282d623</id>
<content type='text'>
Michael Tokarev wrote:
[]
&gt; 2, and this is the main one: How about supplementary groups?
&gt;
&gt; Here I have a valid usage case: a group of testers running various
&gt; versions of windows using KVM (kernel virtual machine), 1 at a time,
&gt; to test some software.  kvm is set up to use bridge with a tap device
&gt; (there should be a way to connect to the machine).  Anyone on that group
&gt; has to be able to start/stop the virtual machines.
&gt;
&gt; My first attempt - pretty obvious when I saw -g option of tunctl - is
&gt; to add group ownership for the tun device and add a supplementary group
&gt; to each user (their primary group should be different).  But that fails,
&gt; since kernel only checks for egid, not any other group ids.
&gt;
&gt; What's the reasoning to not allow supplementary groups and to only check
&gt; for egid?

Signed-off-by: Michael Tokarev &lt;mjt@tls.msk.ru&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
