<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/core, branch v2.6.28.1</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/net/core?h=v2.6.28.1</id>
<link rel='self' href='https://git.amat.us/linux/atom/net/core?h=v2.6.28.1'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2008-12-10T07:22:26Z</updated>
<entry>
<title>netpoll: fix race on poll_list resulting in garbage entry</title>
<updated>2008-12-10T07:22:26Z</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2008-12-10T07:22:26Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7b363e440021a1cf9ed76944b2685f48dacefb3e'/>
<id>urn:sha1:7b363e440021a1cf9ed76944b2685f48dacefb3e</id>
<content type='text'>
	A few months back a race was discused between the netpoll napi service
path, and the fast path through net_rx_action:
http://kerneltrap.org/mailarchive/linux-netdev/2007/10/16/345470

A patch was submitted for that bug, but I think we missed a case.

Consider the following scenario:

INITIAL STATE
CPU0 has one napi_struct A on its poll_list
CPU1 is calling netpoll_send_skb and needs to call poll_napi on the same
napi_struct A that CPU0 has on its list



CPU0						CPU1
net_rx_action					poll_napi
!list_empty (returns true)			locks poll_lock for A
						 poll_one_napi
						  napi-&gt;poll
						   netif_rx_complete
						    __napi_complete
						    (removes A from poll_list)
list_entry(list-&gt;next)


In the above scenario, net_rx_action assumes that the per-cpu poll_list is
exclusive to that cpu.  netpoll of course violates that, and because the netpoll
path can dequeue from the poll list, its possible for CPU0 to detect a non-empty
list at the top of the while loop in net_rx_action, but have it become empty by
the time it calls list_entry.  Since the poll_list isn't surrounded by any other
structure, the returned data from that list_entry call in this situation is
garbage, and any number of crashes can result based on what exactly that garbage
is.

Given that its not fasible for performance reasons to place exclusive locks
arround each cpus poll list to provide that mutal exclusion, I think the best
solution is modify the netpoll path in such a way that we continue to guarantee
that the poll_list for a cpu is in fact exclusive to that cpu.  To do this I've
implemented the patch below.  It adds an additional bit to the state field in
the napi_struct.  When executing napi-&gt;poll from the netpoll_path, this bit will
be set. When a driver calls netif_rx_complete, if that bit is set, it will not
remove the napi_struct from the poll_list.  That work will be saved for the next
iteration of net_rx_action.

I've tested this and it seems to work well.  About the biggest drawback I can
see to it is the fact that it might result in an extra loop through
net_rx_action in the event that the device is actually contended for (i.e. the
netpoll path actually preforms all the needed work no the device, and the call
to net_rx_action winds up doing nothing, except removing the napi_struct from
the poll_list.  However I think this is probably a small price to pay, given
that the alternative is a crash.

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: make skb_truesize_bug() call WARN()</title>
<updated>2008-11-26T05:08:13Z</updated>
<author>
<name>Arjan van de Ven</name>
<email>arjan@linux.intel.com</email>
</author>
<published>2008-11-26T05:08:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8f480c0e4e120911a673ed7385359bf76ae01963'/>
<id>urn:sha1:8f480c0e4e120911a673ed7385359bf76ae01963</id>
<content type='text'>
The truesize message check is important enough to make it print "BUG"
to the user console... lets also make it important enough to spit a
backtrace/module list etc so that kerneloops.org can track them.

Signed-off-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix memory leak in the proto_register function</title>
<updated>2008-11-22T00:45:22Z</updated>
<author>
<name>Catalin Marinas</name>
<email>catalin.marinas@arm.com</email>
</author>
<published>2008-11-22T00:45:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7e56b5d698707a9934833c47b24d78fb0bcaf764'/>
<id>urn:sha1:7e56b5d698707a9934833c47b24d78fb0bcaf764</id>
<content type='text'>
If the slub allocator is used, kmem_cache_create() may merge two or more
kmem_cache's into one but the cache name pointer is not updated and
kmem_cache_name() is no longer guaranteed to return the pointer passed
to the former function. This patch stores the kmalloc'ed pointers in the
corresponding request_sock_ops and timewait_sock_ops structures.

Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Acked-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Reviewed-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>pktgen: fix multiple queue warning</title>
<updated>2008-11-19T22:09:47Z</updated>
<author>
<name>Robert Olsson</name>
<email>robert.olsson@its.uu.se</email>
</author>
<published>2008-11-19T22:09:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bfdbc0acadcc761b94814d78f0acec90f0d760de'/>
<id>urn:sha1:bfdbc0acadcc761b94814d78f0acec90f0d760de</id>
<content type='text'>
As number of TX queues in unrelated to number of CPU's we remove this test
and just make sure nxtq never gets exceeded.

Signed-off-by: Robert Olsson &lt;robert.olsson@its.uu.se&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rtnetlink: propagate error from dev_change_flags in do_setlink()</title>
<updated>2008-11-17T07:20:31Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes@sipsolutions.net</email>
</author>
<published>2008-11-17T07:20:31Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5f9021cfdc3524a4c5e3d7ae2d049eb7adcd6776'/>
<id>urn:sha1:5f9021cfdc3524a4c5e3d7ae2d049eb7adcd6776</id>
<content type='text'>
Unlike ifconfig, iproute doesn't report an error when setting
an interface up fails:

(example: put wireless network mac80211 interface into repeater mode
with iwconfig but do not set a peer MAC address, it should fail with
-ENOLINK)

without patch:
# ip link set wlan0 up ; echo $?
0
# 

with patch:
# ip link set wlan0 up ; echo $?
RTNETLINK answers: Link has been severed
2
# 

Propagate the return value from dev_change_flags() to fix this.

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Tested-by: Johannes Berg &lt;johannes@sipsolutions.net&gt;
Signed-off-by: Johannes Berg &lt;johannes@sipsolutions.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>scm: fix scm_fp_list-&gt;list initialization made in wrong place</title>
<updated>2008-11-14T22:51:45Z</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@openvz.org</email>
</author>
<published>2008-11-14T22:51:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5421ae0153b4ba0469967cfd8de96144e3bf3979'/>
<id>urn:sha1:5421ae0153b4ba0469967cfd8de96144e3bf3979</id>
<content type='text'>
This is the next page of the scm recursion story (the commit 
f8d570a4 net: Fix recursive descent in __scm_destroy()).

In function scm_fp_dup(), the INIT_LIST_HEAD(&amp;fpl-&gt;list) of newly
created fpl is done *before* the subsequent memcpy from the old 
structure and thus the freshly initialized list is overwritten.

But that's OK, since this initialization is not required at all,
since the fpl-&gt;list is list_add-ed at the destruction time in any
case (and is unused in other code), so I propose to drop both
initializations, rather than moving it after the memcpy.

Please, correct me if I miss something significant.

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>lockdep: include/linux/lockdep.h - fix warning in net/bluetooth/af_bluetooth.c</title>
<updated>2008-11-14T07:19:10Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-11-12T01:38:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e8f6fbf62de37cbc2e179176ac7010d5f4396b67'/>
<id>urn:sha1:e8f6fbf62de37cbc2e179176ac7010d5f4396b67</id>
<content type='text'>
fix this warning:

  net/bluetooth/af_bluetooth.c:60: warning: ‘bt_key_strings’ defined but not used
  net/bluetooth/af_bluetooth.c:71: warning: ‘bt_slock_key_strings’ defined but not used

this is a lockdep macro problem in the !LOCKDEP case.

We cannot convert it to an inline because the macro works on multiple types,
but we can mark the parameter used.

[ also clean up a misaligned tab in sock_lock_init_class_and_name() ]

[ also remove #ifdefs from around af_family_clock_key strings - which
  were certainly added to get rid of the ugly build warnings. ]

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: fix setting of skb-&gt;tail in skb_recycle_check()</title>
<updated>2008-11-11T05:45:05Z</updated>
<author>
<name>Lennert Buytenhek</name>
<email>buytenh@marvell.com</email>
</author>
<published>2008-11-11T05:45:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5cd33db2120b5ce972568711156f91da83bff2d7'/>
<id>urn:sha1:5cd33db2120b5ce972568711156f91da83bff2d7</id>
<content type='text'>
Since skb_reset_tail_pointer() reads skb-&gt;data, we need to set
skb-&gt;data before calling skb_reset_tail_pointer().  This was causing
spurious skb_over_panic()s from skb_put() being called on a recycled
skb that had its skb-&gt;tail set to beyond where it should have been.

Bug report from Peter van Valderen &lt;linux@ddcrew.com&gt;.

Signed-off-by: Lennert Buytenhek &lt;buytenh@marvell.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: Fix recursive descent in __scm_destroy().</title>
<updated>2008-11-06T23:45:32Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2008-11-06T23:45:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3b53fbf4314594fa04544b02b2fc6e607912da18'/>
<id>urn:sha1:3b53fbf4314594fa04544b02b2fc6e607912da18</id>
<content type='text'>
__scm_destroy() walks the list of file descriptors in the scm_fp_list
pointed to by the scm_cookie argument.

Those, in turn, can close sockets and invoke __scm_destroy() again.

There is nothing which limits how deeply this can occur.

The idea for how to fix this is from Linus.  Basically, we do all of
the fput()s at the top level by collecting all of the scm_fp_list
objects hit by an fput().  Inside of the initial __scm_destroy() we
keep running the list until it is empty.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: fix packet socket delivery in rx irq handler</title>
<updated>2008-11-04T22:49:57Z</updated>
<author>
<name>Patrick McHardy</name>
<email>kaber@trash.net</email>
</author>
<published>2008-11-04T22:49:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9b22ea560957de1484e6b3e8538f7eef202e3596'/>
<id>urn:sha1:9b22ea560957de1484e6b3e8538f7eef202e3596</id>
<content type='text'>
The changes to deliver hardware accelerated VLAN packets to packet
sockets (commit bc1d0411) caused a warning for non-NAPI drivers.
The __vlan_hwaccel_rx() function is called directly from the drivers
RX function, for non-NAPI drivers that means its still in RX IRQ
context:

[   27.779463] ------------[ cut here ]------------
[   27.779509] WARNING: at kernel/softirq.c:136 local_bh_enable+0x37/0x81()
...
[   27.782520]  [&lt;c0264755&gt;] netif_nit_deliver+0x5b/0x75
[   27.782590]  [&lt;c02bba83&gt;] __vlan_hwaccel_rx+0x79/0x162
[   27.782664]  [&lt;f8851c1d&gt;] atl1_intr+0x9a9/0xa7c [atl1]
[   27.782738]  [&lt;c0155b17&gt;] handle_IRQ_event+0x23/0x51
[   27.782808]  [&lt;c015692e&gt;] handle_edge_irq+0xc2/0x102
[   27.782878]  [&lt;c0105fd5&gt;] do_IRQ+0x4d/0x64

Split hardware accelerated VLAN reception into two parts to fix this:

- __vlan_hwaccel_rx just stores the VLAN TCI and performs the VLAN
  device lookup, then calls netif_receive_skb()/netif_rx()

- vlan_hwaccel_do_receive(), which is invoked by netif_receive_skb()
  in softirq context, performs the real reception and delivery to
  packet sockets.

Reported-and-tested-by: Ramon Casellas &lt;ramon.casellas@cttc.es&gt;
Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
