<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/core/dev.c, branch v2.6.26</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.26</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.26'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2008-07-02T02:57:19Z</updated>
<entry>
<title>netdevice: Fix wrong string handle in kernel command line parsing</title>
<updated>2008-07-02T02:57:19Z</updated>
<author>
<name>Wang Chen</name>
<email>wangchen@cn.fujitsu.com</email>
</author>
<published>2008-07-02T02:57:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=93b3cff9915322d6fa36bac0064714a7076230e4'/>
<id>urn:sha1:93b3cff9915322d6fa36bac0064714a7076230e4</id>
<content type='text'>
v1-&gt;v2: Use strlcpy() to ensure s[i].name be null-termination.

1. In netdev_boot_setup_add(), a long name will leak.
   ex. : dev=21,0x1234,0x1234,0x2345,eth123456789verylongname.........
2. In netdev_boot_setup_check(), mismatch will happen if s[i].name
   is a substring of dev-&gt;name.
   ex. : dev=...eth1 dev=...eth11

[ With feedback from Ben Hutchings. ]

Signed-off-by: Wang Chen &lt;wangchen@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netdevice: Fix typo of dev_unicast_add() comment</title>
<updated>2008-06-28T02:35:16Z</updated>
<author>
<name>Wang Chen</name>
<email>wangchen@cn.fujitsu.com</email>
</author>
<published>2008-06-28T02:35:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5dbaec5dc6a4895db8bf9765a867418481ed7311'/>
<id>urn:sha1:5dbaec5dc6a4895db8bf9765a867418481ed7311</id>
<content type='text'>
Signed-off-by: Wang Chen &lt;wangchen@cn.fujitsu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netns: Don't receive new packets in a dead network namespace.</title>
<updated>2008-06-21T05:16:51Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2008-06-21T05:16:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b9f75f45a6b46a0ab4eb0857d437a0845871f314'/>
<id>urn:sha1:b9f75f45a6b46a0ab4eb0857d437a0845871f314</id>
<content type='text'>
Alexey Dobriyan &lt;adobriyan@gmail.com&gt; writes:
&gt; Subject: ICMP sockets destruction vs ICMP packets oops

&gt; After icmp_sk_exit() nuked ICMP sockets, we get an interrupt.
&gt; icmp_reply() wants ICMP socket.
&gt;
&gt; Steps to reproduce:
&gt;
&gt; 	launch shell in new netns
&gt; 	move real NIC to netns
&gt; 	setup routing
&gt; 	ping -i 0
&gt; 	exit from shell
&gt;
&gt; BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
&gt; IP: [&lt;ffffffff803fce17&gt;] icmp_sk+0x17/0x30
&gt; PGD 17f3cd067 PUD 17f3ce067 PMD 0 
&gt; Oops: 0000 [1] PREEMPT SMP DEBUG_PAGEALLOC
&gt; CPU 0 
&gt; Modules linked in: usblp usbcore
&gt; Pid: 0, comm: swapper Not tainted 2.6.26-rc6-netns-ct #4
&gt; RIP: 0010:[&lt;ffffffff803fce17&gt;]  [&lt;ffffffff803fce17&gt;] icmp_sk+0x17/0x30
&gt; RSP: 0018:ffffffff8057fc30  EFLAGS: 00010286
&gt; RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff81017c7db900
&gt; RDX: 0000000000000034 RSI: ffff81017c7db900 RDI: ffff81017dc41800
&gt; RBP: ffffffff8057fc40 R08: 0000000000000001 R09: 000000000000a815
&gt; R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff8057fd28
&gt; R13: ffffffff8057fd00 R14: ffff81017c7db938 R15: ffff81017dc41800
&gt; FS:  0000000000000000(0000) GS:ffffffff80525000(0000) knlGS:0000000000000000
&gt; CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
&gt; CR2: 0000000000000000 CR3: 000000017fcda000 CR4: 00000000000006e0
&gt; DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
&gt; DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
&gt; Process swapper (pid: 0, threadinfo ffffffff8053a000, task ffffffff804fa4a0)
&gt; Stack:  0000000000000000 ffff81017c7db900 ffffffff8057fcf0 ffffffff803fcfe4
&gt;  ffffffff804faa38 0000000000000246 0000000000005a40 0000000000000246
&gt;  000000000001ffff ffff81017dd68dc0 0000000000005a40 0000000055342436
&gt; Call Trace:
&gt;  &lt;IRQ&gt;  [&lt;ffffffff803fcfe4&gt;] icmp_reply+0x44/0x1e0
&gt;  [&lt;ffffffff803d3a0a&gt;] ? ip_route_input+0x23a/0x1360
&gt;  [&lt;ffffffff803fd645&gt;] icmp_echo+0x65/0x70
&gt;  [&lt;ffffffff803fd300&gt;] icmp_rcv+0x180/0x1b0
&gt;  [&lt;ffffffff803d6d84&gt;] ip_local_deliver+0xf4/0x1f0
&gt;  [&lt;ffffffff803d71bb&gt;] ip_rcv+0x33b/0x650
&gt;  [&lt;ffffffff803bb16a&gt;] netif_receive_skb+0x27a/0x340
&gt;  [&lt;ffffffff803be57d&gt;] process_backlog+0x9d/0x100
&gt;  [&lt;ffffffff803bdd4d&gt;] net_rx_action+0x18d/0x250
&gt;  [&lt;ffffffff80237be5&gt;] __do_softirq+0x75/0x100
&gt;  [&lt;ffffffff8020c97c&gt;] call_softirq+0x1c/0x30
&gt;  [&lt;ffffffff8020f085&gt;] do_softirq+0x65/0xa0
&gt;  [&lt;ffffffff80237af7&gt;] irq_exit+0x97/0xa0
&gt;  [&lt;ffffffff8020f198&gt;] do_IRQ+0xa8/0x130
&gt;  [&lt;ffffffff80212ee0&gt;] ? mwait_idle+0x0/0x60
&gt;  [&lt;ffffffff8020bc46&gt;] ret_from_intr+0x0/0xf
&gt;  &lt;EOI&gt;  [&lt;ffffffff80212f2c&gt;] ? mwait_idle+0x4c/0x60
&gt;  [&lt;ffffffff80212f23&gt;] ? mwait_idle+0x43/0x60
&gt;  [&lt;ffffffff8020a217&gt;] ? cpu_idle+0x57/0xa0
&gt;  [&lt;ffffffff8040f380&gt;] ? rest_init+0x70/0x80
&gt; Code: 10 5b 41 5c 41 5d 41 5e c9 c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 53
&gt; 48 83 ec 08 48 8b 9f 78 01 00 00 e8 2b c7 f1 ff 89 c0 &lt;48&gt; 8b 04 c3 48 83 c4 08
&gt; 5b c9 c3 66 66 66 66 66 2e 0f 1f 84 00
&gt; RIP  [&lt;ffffffff803fce17&gt;] icmp_sk+0x17/0x30
&gt;  RSP &lt;ffffffff8057fc30&gt;
&gt; CR2: 0000000000000000
&gt; ---[ end trace ea161157b76b33e8 ]---
&gt; Kernel panic - not syncing: Aiee, killing interrupt handler!

Receiving packets while we are cleaning up a network namespace is a
racy proposition. It is possible when the packet arrives that we have
removed some but not all of the state we need to fully process it.  We
have the choice of either playing wack-a-mole with the cleanup routines
or simply dropping packets when we don't have a network namespace to
handle them.

Since the check looks inexpensive in netif_receive_skb let's just
drop the incoming packets.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix test for VLAN TX checksum offload capability</title>
<updated>2008-06-17T00:02:28Z</updated>
<author>
<name>Ben Hutchings</name>
<email>bhutchings@solarflare.com</email>
</author>
<published>2008-06-17T00:02:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6de329e26caed7bbbf51229c80f3948549d3c010'/>
<id>urn:sha1:6de329e26caed7bbbf51229c80f3948549d3c010</id>
<content type='text'>
Selected device feature bits can be propagated to VLAN devices, so we
can make use of TX checksum offload and TSO on VLAN-tagged packets.
However, if the physical device does not do VLAN tag insertion or
generic checksum offload then the test for TX checksum offload in
dev_queue_xmit() will see a protocol of htons(ETH_P_8021Q) and yield
false.

This splits the checksum offload test into two functions:

- can_checksum_protocol() tests a given protocol against a feature bitmask

- dev_can_checksum() first tests the skb protocol against the device
  features; if that fails and the protocol is htons(ETH_P_8021Q) then
  it tests the encapsulated protocol against the effective device
  features for VLANs

Signed-off-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Acked-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix call to -&gt;change_rx_flags(dev, IFF_MULTICAST) in dev_change_flags()</title>
<updated>2008-05-20T21:36:14Z</updated>
<author>
<name>David Woodhouse</name>
<email>dwmw2@infradead.org</email>
</author>
<published>2008-05-20T21:36:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0e91796eb46e29edc791131c832a2232bcaed9dd'/>
<id>urn:sha1:0e91796eb46e29edc791131c832a2232bcaed9dd</id>
<content type='text'>
Am I just being particularly dim today, or can the call to
dev-&gt;change_rx_flags(dev, IFF_MULTICAST) in dev_change_flags() never
happen?

We've just set dev-&gt;flags = flags &amp; IFF_MULTICAST, effectively. So the
condition '(dev-&gt;flags ^ flags) &amp; IFF_MULTICAST' is _never_ going to be
true.

Signed-off-by: David Woodhouse &lt;dwmw2@infradead.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: handle errors from device_rename</title>
<updated>2008-05-15T05:33:38Z</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemminger@vyatta.com</email>
</author>
<published>2008-05-15T05:33:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dcc997738e538919101d8756f19ca23110b25d8d'/>
<id>urn:sha1:dcc997738e538919101d8756f19ca23110b25d8d</id>
<content type='text'>
device_rename can fail with -EEXIST or -ENOMEM, so handle any
problems.

Signed-off-by: Stephen Hemminger &lt;shemminger@vyatta.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Added ASSERT_RTNL() to dev_open() and dev_close().</title>
<updated>2008-05-08T09:53:17Z</updated>
<author>
<name>Ben Hutchings</name>
<email>bhutchings@solarflare.com</email>
</author>
<published>2008-05-08T09:53:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e46b66bc42b6b1430b04cc5c207ecb2b2f4553dc'/>
<id>urn:sha1:e46b66bc42b6b1430b04cc5c207ecb2b2f4553dc</id>
<content type='text'>
dev_open() and dev_close() must be called holding the RTNL, since they
call device functions and netdevice notifiers that are promised the RTNL.

Signed-off-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netns: Fix arbitrary net_device-s corruptions on net_ns stop.</title>
<updated>2008-05-08T08:24:25Z</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@openvz.org</email>
</author>
<published>2008-05-08T08:24:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aca51397d01474f80cab8fc978559b45f2e453ad'/>
<id>urn:sha1:aca51397d01474f80cab8fc978559b45f2e453ad</id>
<content type='text'>
When a net namespace is destroyed, some devices (those, not killed
on ns stop explicitly) are moved back to init_net.

The problem, is that this net_ns change has one point of failure -
the __dev_alloc_name() may be called if a name collision occurs (and
this is easy to trigger). This allocator performs a likely-to-fail
GFP_ATOMIC allocation to find a suitable number. Other possible 
conditions that may cause error (for device being ns local or not
registered) are always false in this case.

So, when this call fails, the device is unregistered. But this is
*not* the right thing to do, since after this the device may be
released (and kfree-ed) improperly. E. g. bridges require more
actions (sysfs update, timer disarming, etc.), some other devices 
want to remove their private areas from lists, etc.

I. e. arbitrary use-after-free cases may occur.

The proposed fix is the following: since the only reason for the
dev_change_net_namespace to fail is the name generation, we may
give it a unique fall-back name w/o %d-s in it - the dev&lt;ifindex&gt;
one, since ifindexes are still unique.

So make this change, raise the failure-case printk loglevel to 
EMERG and replace the unregister_netdevice call with BUG().

[ Use snprintf() -DaveM ]

Signed-off-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netns: Fix device renaming for sysfs</title>
<updated>2008-05-03T00:00:58Z</updated>
<author>
<name>Daniel Lezcano</name>
<email>dlezcano@fr.ibm.com</email>
</author>
<published>2008-05-03T00:00:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aaf8cdc34ddba08122f02217d9d684e2f9f5d575'/>
<id>urn:sha1:aaf8cdc34ddba08122f02217d9d684e2f9f5d575</id>
<content type='text'>
When a netdev is moved across namespaces with the
'dev_change_net_namespace' function, the 'device_rename' function is
used to fixup kobject and refresh the sysfs tree. The device_rename
function will call kobject_rename and this one will check if there is
an object with the same name and this is the case because we are
renaming the object with the same name.

The use of 'device_rename' seems for me wrong because we usually don't
rename it but just move it across namespaces. As we just want to do a
mini "netdev_[un]register", IMO the functions
'netdev_[un]register_kobject' should be used instead, like an usual
network device [un]registering.

This patch replace device_rename by netdev_unregister_kobject,
followed by netdev_register_kobject.

The netdev_register_kobject will call device_initialize and will raise
a warning indicating the device was already initialized. In order to
fix that, I split the device initialization into a separate function
and use it together with 'netdev_register_kobject' into
register_netdevice. So we can safely call 'netdev_register_kobject' in
'dev_change_net_namespace'.

This fix will allow to properly use the sysfs per namespace which is
coming from -mm tree.

Signed-off-by: Daniel Lezcano &lt;dlezcano@fr.ibm.com&gt;
Acked-by: Benjamin Thery &lt;benjamin.thery@bull.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: remove NR_CPUS arrays in net/core/dev.c</title>
<updated>2008-05-02T23:43:08Z</updated>
<author>
<name>Mike Travis</name>
<email>travis@sgi.com</email>
</author>
<published>2008-05-02T23:43:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0c0b0aca66b3a58e12a216d992a0b534eff210e0'/>
<id>urn:sha1:0c0b0aca66b3a58e12a216d992a0b534eff210e0</id>
<content type='text'>
Remove the fixed size channels[NR_CPUS] array in net/core/dev.c and
dynamically allocate array based on nr_cpu_ids.

Signed-off-by: Mike Travis &lt;travis@sgi.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
