<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/net/core, branch v3.4.40</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.4.40</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.4.40'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2013-04-05T17:04:47Z</updated>
<entry>
<title>net: add a synchronize_net() in netdev_rx_handler_unregister()</title>
<updated>2013-04-05T17:04:47Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-03-29T03:01:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f0180de2669df4b9e83a37417369ae7ef7cb71ff'/>
<id>urn:sha1:f0180de2669df4b9e83a37417369ae7ef7cb71ff</id>
<content type='text'>
[ Upstream commit 00cfec37484761a44a3b6f4675a54caa618210ae ]

commit 35d48903e97819 (bonding: fix rx_handler locking) added a race
in bonding driver, reported by Steven Rostedt who did a very good
diagnosis :

&lt;quoting Steven&gt;

I'm currently debugging a crash in an old 3.0-rt kernel that one of our
customers is seeing. The bug happens with a stress test that loads and
unloads the bonding module in a loop (I don't know all the details as
I'm not the one that is directly interacting with the customer). But the
bug looks to be something that may still be present and possibly present
in mainline too. It will just be much harder to trigger it in mainline.

In -rt, interrupts are threads, and can schedule in and out just like
any other thread. Note, mainline now supports interrupt threads so this
may be easily reproducible in mainline as well. I don't have the ability
to tell the customer to try mainline or other kernels, so my hands are
somewhat tied to what I can do.

But according to a core dump, I tracked down that the eth irq thread
crashed in bond_handle_frame() here:

        slave = bond_slave_get_rcu(skb-&gt;dev);
        bond = slave-&gt;bond; &lt;--- BUG

the slave returned was NULL and accessing slave-&gt;bond caused a NULL
pointer dereference.

Looking at the code that unregisters the handler:

void netdev_rx_handler_unregister(struct net_device *dev)
{

        ASSERT_RTNL();
        RCU_INIT_POINTER(dev-&gt;rx_handler, NULL);
        RCU_INIT_POINTER(dev-&gt;rx_handler_data, NULL);
}

Which is basically:
        dev-&gt;rx_handler = NULL;
        dev-&gt;rx_handler_data = NULL;

And looking at __netif_receive_skb() we have:

        rx_handler = rcu_dereference(skb-&gt;dev-&gt;rx_handler);
        if (rx_handler) {
                if (pt_prev) {
                        ret = deliver_skb(skb, pt_prev, orig_dev);
                        pt_prev = NULL;
                }
                switch (rx_handler(&amp;skb)) {

My question to all of you is, what stops this interrupt from happening
while the bonding module is unloading?  What happens if the interrupt
triggers and we have this:

        CPU0                    CPU1
        ----                    ----
  rx_handler = skb-&gt;dev-&gt;rx_handler

                        netdev_rx_handler_unregister() {
                           dev-&gt;rx_handler = NULL;
                           dev-&gt;rx_handler_data = NULL;

  rx_handler()
   bond_handle_frame() {
    slave = skb-&gt;dev-&gt;rx_handler;
    bond = slave-&gt;bond; &lt;-- NULL pointer dereference!!!

What protection am I missing in the bond release handler that would
prevent the above from happening?

&lt;/quoting Steven&gt;

We can fix bug this in two ways. First is adding a test in
bond_handle_frame() and others to check if rx_handler_data is NULL.

A second way is adding a synchronize_net() in
netdev_rx_handler_unregister() to make sure that a rcu protected reader
has the guarantee to see a non NULL rx_handler_data.

The second way is better as it avoids an extra test in fast path.

Reported-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Jiri Pirko &lt;jpirko@redhat.com&gt;
Cc: Paul E. McKenney &lt;paulmck@us.ibm.com&gt;
Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Reviewed-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net: remove a WARN_ON() in net_enable_timestamp()</title>
<updated>2013-04-05T17:04:37Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-03-22T14:38:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a897b791b846a7c023f6860d6e2477152244d486'/>
<id>urn:sha1:a897b791b846a7c023f6860d6e2477152244d486</id>
<content type='text'>
[ Upstream commit 9979a55a833883242e3a29f3596676edd7199c46 ]

The WARN_ON(in_interrupt()) in net_enable_timestamp() can get false
positive, in socket clone path, run from softirq context :

[ 3641.624425] WARNING: at net/core/dev.c:1532 net_enable_timestamp+0x7b/0x80()
[ 3641.668811] Call Trace:
[ 3641.671254]  &lt;IRQ&gt;  [&lt;ffffffff80286817&gt;] warn_slowpath_common+0x87/0xc0
[ 3641.677871]  [&lt;ffffffff8028686a&gt;] warn_slowpath_null+0x1a/0x20
[ 3641.683683]  [&lt;ffffffff80742f8b&gt;] net_enable_timestamp+0x7b/0x80
[ 3641.689668]  [&lt;ffffffff80732ce5&gt;] sk_clone_lock+0x425/0x450
[ 3641.695222]  [&lt;ffffffff8078db36&gt;] inet_csk_clone_lock+0x16/0x170
[ 3641.701213]  [&lt;ffffffff807ae449&gt;] tcp_create_openreq_child+0x29/0x820
[ 3641.707663]  [&lt;ffffffff807d62e2&gt;] ? ipt_do_table+0x222/0x670
[ 3641.713354]  [&lt;ffffffff807aaf5b&gt;] tcp_v4_syn_recv_sock+0xab/0x3d0
[ 3641.719425]  [&lt;ffffffff807af63a&gt;] tcp_check_req+0x3da/0x530
[ 3641.724979]  [&lt;ffffffff8078b400&gt;] ? inet_hashinfo_init+0x60/0x80
[ 3641.730964]  [&lt;ffffffff807ade6f&gt;] ? tcp_v4_rcv+0x79f/0xbe0
[ 3641.736430]  [&lt;ffffffff807ab9bd&gt;] tcp_v4_do_rcv+0x38d/0x4f0
[ 3641.741985]  [&lt;ffffffff807ae14a&gt;] tcp_v4_rcv+0xa7a/0xbe0

Its safe at this point because the parent socket owns a reference
on the netstamp_needed, so we cant have a 0 -&gt; 1 transition, which
requires to lock a mutex.

Instead of refining the check, lets remove it, as all known callers
are safe. If it ever changes in the future, static_key_slow_inc()
will complain anyway.

Reported-by: Laurent Chavey &lt;chavey@google.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>rtnetlink: Mask the rta_type when range checking</title>
<updated>2013-03-28T19:11:53Z</updated>
<author>
<name>Vlad Yasevich</name>
<email>vyasevic@redhat.com</email>
</author>
<published>2013-03-13T04:18:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=08ebc8f4c0acb1e9a104e66fdc2bb5b4e29171f5'/>
<id>urn:sha1:08ebc8f4c0acb1e9a104e66fdc2bb5b4e29171f5</id>
<content type='text'>
[ Upstream commit a5b8db91442fce9c9713fcd656c3698f1adde1d6 ]

Range/validity checks on rta_type in rtnetlink_rcv_msg() do
not account for flags that may be set.  This causes the function
to return -EINVAL when flags are set on the type (for example
NLA_F_NESTED).

Signed-off-by: Vlad Yasevich &lt;vyasevic@redhat.com&gt;
Acked-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>rtnl: fix info leak on RTM_GETLINK request for VF devices</title>
<updated>2013-03-20T20:05:02Z</updated>
<author>
<name>Mathias Krause</name>
<email>minipli@googlemail.com</email>
</author>
<published>2013-03-09T05:52:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=78d3a467490d72c699393947f1e566fa28672947'/>
<id>urn:sha1:78d3a467490d72c699393947f1e566fa28672947</id>
<content type='text'>
[ Upstream commit 84d73cd3fb142bf1298a8c13fd4ca50fd2432372 ]

Initialize the mac address buffer with 0 as the driver specific function
will probably not fill the whole buffer. In fact, all in-kernel drivers
fill only ETH_ALEN of the MAX_ADDR_LEN bytes, i.e. 6 of the 32 possible
bytes. Therefore we currently leak 26 bytes of stack memory to userland
via the netlink interface.

Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bridging: fix rx_handlers return code</title>
<updated>2013-03-20T20:05:02Z</updated>
<author>
<name>Cristian Bercaru</name>
<email>B43982@freescale.com</email>
</author>
<published>2013-03-08T07:03:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c7a226b6464bfdc67433adcfe9e17b816157af98'/>
<id>urn:sha1:c7a226b6464bfdc67433adcfe9e17b816157af98</id>
<content type='text'>
[ Upstream commit 3bc1b1add7a8484cc4a261c3e128dbe1528ce01f ]

The frames for which rx_handlers return RX_HANDLER_CONSUMED are no longer
counted as dropped. They are counted as successfully received by
'netif_receive_skb'.

This allows network interface drivers to correctly update their RX-OK and
RX-DRP counters based on the result of 'netif_receive_skb'.

Signed-off-by: Cristian Bercaru &lt;B43982@freescale.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>sock_diag: Fix out-of-bounds access to sock_diag_handlers[]</title>
<updated>2013-02-28T14:59:06Z</updated>
<author>
<name>Mathias Krause</name>
<email>minipli@googlemail.com</email>
</author>
<published>2013-02-23T01:13:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8c2223fc19032e7b8761e46c15e1ed167a252285'/>
<id>urn:sha1:8c2223fc19032e7b8761e46c15e1ed167a252285</id>
<content type='text'>
[ Upstream commit 6e601a53566d84e1ffd25e7b6fe0b6894ffd79c0 ]

Userland can send a netlink message requesting SOCK_DIAG_BY_FAMILY
with a family greater or equal then AF_MAX -- the array size of
sock_diag_handlers[]. The current code does not test for this
condition therefore is vulnerable to an out-of-bound access opening
doors for a privilege escalation.

Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net: fix infinite loop in __skb_recv_datagram()</title>
<updated>2013-02-28T14:59:06Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-02-12T06:16:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b5428e471b91192a2438d04c1d2ff2b3d4708366'/>
<id>urn:sha1:b5428e471b91192a2438d04c1d2ff2b3d4708366</id>
<content type='text'>
[ Upstream commit 77c1090f94d1b0b5186fb13a1b71b47b1343f87f ]

Tommi was fuzzing with trinity and reported the following problem :

commit 3f518bf745 (datagram: Add offset argument to __skb_recv_datagram)
missed that a raw socket receive queue can contain skbs with no payload.

We can loop in __skb_recv_datagram() with MSG_PEEK mode, because
wait_for_packet() is not prepared to skip these skbs.

[   83.541011] INFO: rcu_sched detected stalls on CPUs/tasks: {}
(detected by 0, t=26002 jiffies, g=27673, c=27672, q=75)
[   83.541011] INFO: Stall ended before state dump start
[  108.067010] BUG: soft lockup - CPU#0 stuck for 22s! [trinity-child31:2847]
...
[  108.067010] Call Trace:
[  108.067010]  [&lt;ffffffff818cc103&gt;] __skb_recv_datagram+0x1a3/0x3b0
[  108.067010]  [&lt;ffffffff818cc33d&gt;] skb_recv_datagram+0x2d/0x30
[  108.067010]  [&lt;ffffffff819ed43d&gt;] rawv6_recvmsg+0xad/0x240
[  108.067010]  [&lt;ffffffff818c4b04&gt;] sock_common_recvmsg+0x34/0x50
[  108.067010]  [&lt;ffffffff818bc8ec&gt;] sock_recvmsg+0xbc/0xf0
[  108.067010]  [&lt;ffffffff818bf31e&gt;] sys_recvfrom+0xde/0x150
[  108.067010]  [&lt;ffffffff81ca4329&gt;] system_call_fastpath+0x16/0x1b

Reported-by: Tommi Rantala &lt;tt.rantala@gmail.com&gt;
Tested-by: Tommi Rantala &lt;tt.rantala@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Acked-by: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>pktgen: correctly handle failures when adding a device</title>
<updated>2013-02-14T18:49:05Z</updated>
<author>
<name>Cong Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2013-01-27T21:14:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6c1128b87d5814de27f8ddc445783a81914b194f'/>
<id>urn:sha1:6c1128b87d5814de27f8ddc445783a81914b194f</id>
<content type='text'>
[ Upstream commit 604dfd6efc9b79bce432f2394791708d8e8f6efc ]

The return value of pktgen_add_device() is not checked, so
even if we fail to add some device, for example, non-exist one,
we still see "OK:...". This patch fixes it.

After this patch, I got:

	# echo "add_device non-exist" &gt; /proc/net/pktgen/kpktgend_0
	-bash: echo: write error: No such device
	# cat /proc/net/pktgen/kpktgend_0
	Running:
	Stopped:
	Result: ERROR: can not add device non-exist
	# echo "add_device eth0" &gt; /proc/net/pktgen/kpktgend_0
	# cat /proc/net/pktgen/kpktgend_0
	Running:
	Stopped: eth0
	Result: OK: add_device=eth0

(Candidate for -stable)

Cc: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net-rps: Fix brokeness causing OOO packets</title>
<updated>2012-11-26T19:37:47Z</updated>
<author>
<name>Tom Herbert</name>
<email>therbert@google.com</email>
</author>
<published>2012-11-16T09:04:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f86c309e326f800e8fb028df35051aac5a26ef8d'/>
<id>urn:sha1:f86c309e326f800e8fb028df35051aac5a26ef8d</id>
<content type='text'>
[ Upstream commit baefa31db2f2b13a05d1b81bdf2d20d487f58b0a ]

In commit c445477d74ab3779 which adds aRFS to the kernel, the CPU
selected for RFS is not set correctly when CPU is changing.
This is causing OOO packets and probably other issues.

Signed-off-by: Tom Herbert &lt;therbert@google.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Acked-by: Ben Hutchings &lt;bhutchings@solarflare.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net: correct check in dev_addr_del()</title>
<updated>2012-11-26T19:37:46Z</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@resnulli.us</email>
</author>
<published>2012-11-14T02:51:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4e95708469b3b36b123c9ebfe4fed2b9de601e7a'/>
<id>urn:sha1:4e95708469b3b36b123c9ebfe4fed2b9de601e7a</id>
<content type='text'>
[ Upstream commit a652208e0b52c190e57f2a075ffb5e897fe31c3b ]

Check (ha-&gt;addr == dev-&gt;dev_addr) is always true because dev_addr_init()
sets this. Correct the check to behave properly on addr removal.

Signed-off-by: Jiri Pirko &lt;jiri@resnulli.us&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
