<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/net/ipv4/ip_fragment.c, branch v4.4.56</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>inet: frag: Always orphan skbs inside ip_defrag()</title>
<updated>2016-03-03T23:07:04+00:00</updated>
<author>
<name>Joe Stringer</name>
<email>joe@ovn.org</email>
</author>
<published>2016-01-22T23:49:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=649dc6c32e516972128502ad6a45a16b96098567'/>
<id>649dc6c32e516972128502ad6a45a16b96098567</id>
<content type='text'>
[ Upstream commit 8282f27449bf15548cb82c77b6e04ee0ab827bdc ]

Later parts of the stack (including fragmentation) expect that there is
never a socket attached to frag in a frag_list, however this invariant
was not enforced on all defrag paths. This could lead to the
BUG_ON(skb-&gt;sk) during ip_do_fragment(), as per the call stack at the
end of this commit message.

While the call could be added to openvswitch to fix this particular
error, the head and tail of the frags list are already orphaned
indirectly inside ip_defrag(), so it seems like the remaining fragments
should all be orphaned in all circumstances.

kernel BUG at net/ipv4/ip_output.c:586!
[...]
Call Trace:
 &lt;IRQ&gt;
 [&lt;ffffffffa0205270&gt;] ? do_output.isra.29+0x1b0/0x1b0 [openvswitch]
 [&lt;ffffffffa02167a7&gt;] ovs_fragment+0xcc/0x214 [openvswitch]
 [&lt;ffffffff81667830&gt;] ? dst_discard_out+0x20/0x20
 [&lt;ffffffff81667810&gt;] ? dst_ifdown+0x80/0x80
 [&lt;ffffffffa0212072&gt;] ? find_bucket.isra.2+0x62/0x70 [openvswitch]
 [&lt;ffffffff810e0ba5&gt;] ? mod_timer_pending+0x65/0x210
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffffa03205a2&gt;] ? nf_conntrack_in+0x252/0x500 [nf_conntrack]
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffffa02051a3&gt;] do_output.isra.29+0xe3/0x1b0 [openvswitch]
 [&lt;ffffffffa0206411&gt;] do_execute_actions+0xe11/0x11f0 [openvswitch]
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffffa0206822&gt;] ovs_execute_actions+0x32/0xd0 [openvswitch]
 [&lt;ffffffffa020b505&gt;] ovs_dp_process_packet+0x85/0x140 [openvswitch]
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffffa02068a2&gt;] ovs_execute_actions+0xb2/0xd0 [openvswitch]
 [&lt;ffffffffa020b505&gt;] ovs_dp_process_packet+0x85/0x140 [openvswitch]
 [&lt;ffffffffa0215019&gt;] ? ovs_ct_get_labels+0x49/0x80 [openvswitch]
 [&lt;ffffffffa0213a1d&gt;] ovs_vport_receive+0x5d/0xa0 [openvswitch]
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffffa0214895&gt;] ? internal_dev_xmit+0x5/0x140 [openvswitch]
 [&lt;ffffffffa02148fc&gt;] internal_dev_xmit+0x6c/0x140 [openvswitch]
 [&lt;ffffffffa0214895&gt;] ? internal_dev_xmit+0x5/0x140 [openvswitch]
 [&lt;ffffffff81660299&gt;] dev_hard_start_xmit+0x2b9/0x5e0
 [&lt;ffffffff8165fc21&gt;] ? netif_skb_features+0xd1/0x1f0
 [&lt;ffffffff81660f20&gt;] __dev_queue_xmit+0x800/0x930
 [&lt;ffffffff81660770&gt;] ? __dev_queue_xmit+0x50/0x930
 [&lt;ffffffff810b53f1&gt;] ? mark_held_locks+0x71/0x90
 [&lt;ffffffff81669876&gt;] ? neigh_resolve_output+0x106/0x220
 [&lt;ffffffff81661060&gt;] dev_queue_xmit+0x10/0x20
 [&lt;ffffffff816698e8&gt;] neigh_resolve_output+0x178/0x220
 [&lt;ffffffff816a8e6f&gt;] ? ip_finish_output2+0x1ff/0x590
 [&lt;ffffffff816a8e6f&gt;] ip_finish_output2+0x1ff/0x590
 [&lt;ffffffff816a8cee&gt;] ? ip_finish_output2+0x7e/0x590
 [&lt;ffffffff816a9a31&gt;] ip_do_fragment+0x831/0x8a0
 [&lt;ffffffff816a8c70&gt;] ? ip_copy_metadata+0x1b0/0x1b0
 [&lt;ffffffff816a9ae3&gt;] ip_fragment.constprop.49+0x43/0x80
 [&lt;ffffffff816a9c9c&gt;] ip_finish_output+0x17c/0x340
 [&lt;ffffffff8169a6f4&gt;] ? nf_hook_slow+0xe4/0x190
 [&lt;ffffffff816ab4c0&gt;] ip_output+0x70/0x110
 [&lt;ffffffff816a9b20&gt;] ? ip_fragment.constprop.49+0x80/0x80
 [&lt;ffffffff816aa9f9&gt;] ip_local_out+0x39/0x70
 [&lt;ffffffff816abf89&gt;] ip_send_skb+0x19/0x40
 [&lt;ffffffff816abfe3&gt;] ip_push_pending_frames+0x33/0x40
 [&lt;ffffffff816df21a&gt;] icmp_push_reply+0xea/0x120
 [&lt;ffffffff816df93d&gt;] icmp_reply.constprop.23+0x1ed/0x230
 [&lt;ffffffff816df9ce&gt;] icmp_echo.part.21+0x4e/0x50
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffff810d5f9e&gt;] ? rcu_read_lock_held+0x5e/0x70
 [&lt;ffffffff816dfa06&gt;] icmp_echo+0x36/0x70
 [&lt;ffffffff816e0d11&gt;] icmp_rcv+0x271/0x450
 [&lt;ffffffff816a4ca7&gt;] ip_local_deliver_finish+0x127/0x3a0
 [&lt;ffffffff816a4bc1&gt;] ? ip_local_deliver_finish+0x41/0x3a0
 [&lt;ffffffff816a5160&gt;] ip_local_deliver+0x60/0xd0
 [&lt;ffffffff816a4b80&gt;] ? ip_rcv_finish+0x560/0x560
 [&lt;ffffffff816a46fd&gt;] ip_rcv_finish+0xdd/0x560
 [&lt;ffffffff816a5453&gt;] ip_rcv+0x283/0x3e0
 [&lt;ffffffff810b6302&gt;] ? match_held_lock+0x192/0x200
 [&lt;ffffffff816a4620&gt;] ? inet_del_offload+0x40/0x40
 [&lt;ffffffff8165d062&gt;] __netif_receive_skb_core+0x392/0xae0
 [&lt;ffffffff8165e68e&gt;] ? process_backlog+0x8e/0x230
 [&lt;ffffffff810b53f1&gt;] ? mark_held_locks+0x71/0x90
 [&lt;ffffffff8165d7c8&gt;] __netif_receive_skb+0x18/0x60
 [&lt;ffffffff8165e678&gt;] process_backlog+0x78/0x230
 [&lt;ffffffff8165e6dd&gt;] ? process_backlog+0xdd/0x230
 [&lt;ffffffff8165e355&gt;] net_rx_action+0x155/0x400
 [&lt;ffffffff8106b48c&gt;] __do_softirq+0xcc/0x420
 [&lt;ffffffff816a8e87&gt;] ? ip_finish_output2+0x217/0x590
 [&lt;ffffffff8178e78c&gt;] do_softirq_own_stack+0x1c/0x30
 &lt;EOI&gt;
 [&lt;ffffffff8106b88e&gt;] do_softirq+0x4e/0x60
 [&lt;ffffffff8106b948&gt;] __local_bh_enable_ip+0xa8/0xb0
 [&lt;ffffffff816a8eb0&gt;] ip_finish_output2+0x240/0x590
 [&lt;ffffffff816a9a31&gt;] ? ip_do_fragment+0x831/0x8a0
 [&lt;ffffffff816a9a31&gt;] ip_do_fragment+0x831/0x8a0
 [&lt;ffffffff816a8c70&gt;] ? ip_copy_metadata+0x1b0/0x1b0
 [&lt;ffffffff816a9ae3&gt;] ip_fragment.constprop.49+0x43/0x80
 [&lt;ffffffff816a9c9c&gt;] ip_finish_output+0x17c/0x340
 [&lt;ffffffff8169a6f4&gt;] ? nf_hook_slow+0xe4/0x190
 [&lt;ffffffff816ab4c0&gt;] ip_output+0x70/0x110
 [&lt;ffffffff816a9b20&gt;] ? ip_fragment.constprop.49+0x80/0x80
 [&lt;ffffffff816aa9f9&gt;] ip_local_out+0x39/0x70
 [&lt;ffffffff816abf89&gt;] ip_send_skb+0x19/0x40
 [&lt;ffffffff816abfe3&gt;] ip_push_pending_frames+0x33/0x40
 [&lt;ffffffff816d55d3&gt;] raw_sendmsg+0x7d3/0xc30
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffff816e7557&gt;] ? inet_sendmsg+0xc7/0x1d0
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffff816e759a&gt;] inet_sendmsg+0x10a/0x1d0
 [&lt;ffffffff816e7495&gt;] ? inet_sendmsg+0x5/0x1d0
 [&lt;ffffffff8163e398&gt;] sock_sendmsg+0x38/0x50
 [&lt;ffffffff8163ec5f&gt;] ___sys_sendmsg+0x25f/0x270
 [&lt;ffffffff811aadad&gt;] ? handle_mm_fault+0x8dd/0x1320
 [&lt;ffffffff8178c147&gt;] ? _raw_spin_unlock+0x27/0x40
 [&lt;ffffffff810529b2&gt;] ? __do_page_fault+0x1e2/0x460
 [&lt;ffffffff81204886&gt;] ? __fget_light+0x66/0x90
 [&lt;ffffffff8163f8e2&gt;] __sys_sendmsg+0x42/0x80
 [&lt;ffffffff8163f932&gt;] SyS_sendmsg+0x12/0x20
 [&lt;ffffffff8178cb17&gt;] entry_SYSCALL_64_fastpath+0x12/0x6f
Code: 00 00 44 89 e0 e9 7c fb ff ff 4c 89 ff e8 e7 e7 ff ff 41 8b 9d 80 00 00 00 2b 5d d4 89 d8 c1 f8 03 0f b7 c0 e9 33 ff ff f
 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48
RIP  [&lt;ffffffff816a9a92&gt;] ip_do_fragment+0x892/0x8a0
 RSP &lt;ffff88006d603170&gt;

Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Signed-off-by: Joe Stringer &lt;joe@ovn.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 8282f27449bf15548cb82c77b6e04ee0ab827bdc ]

Later parts of the stack (including fragmentation) expect that there is
never a socket attached to frag in a frag_list, however this invariant
was not enforced on all defrag paths. This could lead to the
BUG_ON(skb-&gt;sk) during ip_do_fragment(), as per the call stack at the
end of this commit message.

While the call could be added to openvswitch to fix this particular
error, the head and tail of the frags list are already orphaned
indirectly inside ip_defrag(), so it seems like the remaining fragments
should all be orphaned in all circumstances.

kernel BUG at net/ipv4/ip_output.c:586!
[...]
Call Trace:
 &lt;IRQ&gt;
 [&lt;ffffffffa0205270&gt;] ? do_output.isra.29+0x1b0/0x1b0 [openvswitch]
 [&lt;ffffffffa02167a7&gt;] ovs_fragment+0xcc/0x214 [openvswitch]
 [&lt;ffffffff81667830&gt;] ? dst_discard_out+0x20/0x20
 [&lt;ffffffff81667810&gt;] ? dst_ifdown+0x80/0x80
 [&lt;ffffffffa0212072&gt;] ? find_bucket.isra.2+0x62/0x70 [openvswitch]
 [&lt;ffffffff810e0ba5&gt;] ? mod_timer_pending+0x65/0x210
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffffa03205a2&gt;] ? nf_conntrack_in+0x252/0x500 [nf_conntrack]
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffffa02051a3&gt;] do_output.isra.29+0xe3/0x1b0 [openvswitch]
 [&lt;ffffffffa0206411&gt;] do_execute_actions+0xe11/0x11f0 [openvswitch]
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffffa0206822&gt;] ovs_execute_actions+0x32/0xd0 [openvswitch]
 [&lt;ffffffffa020b505&gt;] ovs_dp_process_packet+0x85/0x140 [openvswitch]
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffffa02068a2&gt;] ovs_execute_actions+0xb2/0xd0 [openvswitch]
 [&lt;ffffffffa020b505&gt;] ovs_dp_process_packet+0x85/0x140 [openvswitch]
 [&lt;ffffffffa0215019&gt;] ? ovs_ct_get_labels+0x49/0x80 [openvswitch]
 [&lt;ffffffffa0213a1d&gt;] ovs_vport_receive+0x5d/0xa0 [openvswitch]
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffffa0214895&gt;] ? internal_dev_xmit+0x5/0x140 [openvswitch]
 [&lt;ffffffffa02148fc&gt;] internal_dev_xmit+0x6c/0x140 [openvswitch]
 [&lt;ffffffffa0214895&gt;] ? internal_dev_xmit+0x5/0x140 [openvswitch]
 [&lt;ffffffff81660299&gt;] dev_hard_start_xmit+0x2b9/0x5e0
 [&lt;ffffffff8165fc21&gt;] ? netif_skb_features+0xd1/0x1f0
 [&lt;ffffffff81660f20&gt;] __dev_queue_xmit+0x800/0x930
 [&lt;ffffffff81660770&gt;] ? __dev_queue_xmit+0x50/0x930
 [&lt;ffffffff810b53f1&gt;] ? mark_held_locks+0x71/0x90
 [&lt;ffffffff81669876&gt;] ? neigh_resolve_output+0x106/0x220
 [&lt;ffffffff81661060&gt;] dev_queue_xmit+0x10/0x20
 [&lt;ffffffff816698e8&gt;] neigh_resolve_output+0x178/0x220
 [&lt;ffffffff816a8e6f&gt;] ? ip_finish_output2+0x1ff/0x590
 [&lt;ffffffff816a8e6f&gt;] ip_finish_output2+0x1ff/0x590
 [&lt;ffffffff816a8cee&gt;] ? ip_finish_output2+0x7e/0x590
 [&lt;ffffffff816a9a31&gt;] ip_do_fragment+0x831/0x8a0
 [&lt;ffffffff816a8c70&gt;] ? ip_copy_metadata+0x1b0/0x1b0
 [&lt;ffffffff816a9ae3&gt;] ip_fragment.constprop.49+0x43/0x80
 [&lt;ffffffff816a9c9c&gt;] ip_finish_output+0x17c/0x340
 [&lt;ffffffff8169a6f4&gt;] ? nf_hook_slow+0xe4/0x190
 [&lt;ffffffff816ab4c0&gt;] ip_output+0x70/0x110
 [&lt;ffffffff816a9b20&gt;] ? ip_fragment.constprop.49+0x80/0x80
 [&lt;ffffffff816aa9f9&gt;] ip_local_out+0x39/0x70
 [&lt;ffffffff816abf89&gt;] ip_send_skb+0x19/0x40
 [&lt;ffffffff816abfe3&gt;] ip_push_pending_frames+0x33/0x40
 [&lt;ffffffff816df21a&gt;] icmp_push_reply+0xea/0x120
 [&lt;ffffffff816df93d&gt;] icmp_reply.constprop.23+0x1ed/0x230
 [&lt;ffffffff816df9ce&gt;] icmp_echo.part.21+0x4e/0x50
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffff810d5f9e&gt;] ? rcu_read_lock_held+0x5e/0x70
 [&lt;ffffffff816dfa06&gt;] icmp_echo+0x36/0x70
 [&lt;ffffffff816e0d11&gt;] icmp_rcv+0x271/0x450
 [&lt;ffffffff816a4ca7&gt;] ip_local_deliver_finish+0x127/0x3a0
 [&lt;ffffffff816a4bc1&gt;] ? ip_local_deliver_finish+0x41/0x3a0
 [&lt;ffffffff816a5160&gt;] ip_local_deliver+0x60/0xd0
 [&lt;ffffffff816a4b80&gt;] ? ip_rcv_finish+0x560/0x560
 [&lt;ffffffff816a46fd&gt;] ip_rcv_finish+0xdd/0x560
 [&lt;ffffffff816a5453&gt;] ip_rcv+0x283/0x3e0
 [&lt;ffffffff810b6302&gt;] ? match_held_lock+0x192/0x200
 [&lt;ffffffff816a4620&gt;] ? inet_del_offload+0x40/0x40
 [&lt;ffffffff8165d062&gt;] __netif_receive_skb_core+0x392/0xae0
 [&lt;ffffffff8165e68e&gt;] ? process_backlog+0x8e/0x230
 [&lt;ffffffff810b53f1&gt;] ? mark_held_locks+0x71/0x90
 [&lt;ffffffff8165d7c8&gt;] __netif_receive_skb+0x18/0x60
 [&lt;ffffffff8165e678&gt;] process_backlog+0x78/0x230
 [&lt;ffffffff8165e6dd&gt;] ? process_backlog+0xdd/0x230
 [&lt;ffffffff8165e355&gt;] net_rx_action+0x155/0x400
 [&lt;ffffffff8106b48c&gt;] __do_softirq+0xcc/0x420
 [&lt;ffffffff816a8e87&gt;] ? ip_finish_output2+0x217/0x590
 [&lt;ffffffff8178e78c&gt;] do_softirq_own_stack+0x1c/0x30
 &lt;EOI&gt;
 [&lt;ffffffff8106b88e&gt;] do_softirq+0x4e/0x60
 [&lt;ffffffff8106b948&gt;] __local_bh_enable_ip+0xa8/0xb0
 [&lt;ffffffff816a8eb0&gt;] ip_finish_output2+0x240/0x590
 [&lt;ffffffff816a9a31&gt;] ? ip_do_fragment+0x831/0x8a0
 [&lt;ffffffff816a9a31&gt;] ip_do_fragment+0x831/0x8a0
 [&lt;ffffffff816a8c70&gt;] ? ip_copy_metadata+0x1b0/0x1b0
 [&lt;ffffffff816a9ae3&gt;] ip_fragment.constprop.49+0x43/0x80
 [&lt;ffffffff816a9c9c&gt;] ip_finish_output+0x17c/0x340
 [&lt;ffffffff8169a6f4&gt;] ? nf_hook_slow+0xe4/0x190
 [&lt;ffffffff816ab4c0&gt;] ip_output+0x70/0x110
 [&lt;ffffffff816a9b20&gt;] ? ip_fragment.constprop.49+0x80/0x80
 [&lt;ffffffff816aa9f9&gt;] ip_local_out+0x39/0x70
 [&lt;ffffffff816abf89&gt;] ip_send_skb+0x19/0x40
 [&lt;ffffffff816abfe3&gt;] ip_push_pending_frames+0x33/0x40
 [&lt;ffffffff816d55d3&gt;] raw_sendmsg+0x7d3/0xc30
 [&lt;ffffffff810b732b&gt;] ? __lock_acquire+0x3db/0x1b90
 [&lt;ffffffff816e7557&gt;] ? inet_sendmsg+0xc7/0x1d0
 [&lt;ffffffff810b63c4&gt;] ? __lock_is_held+0x54/0x70
 [&lt;ffffffff816e759a&gt;] inet_sendmsg+0x10a/0x1d0
 [&lt;ffffffff816e7495&gt;] ? inet_sendmsg+0x5/0x1d0
 [&lt;ffffffff8163e398&gt;] sock_sendmsg+0x38/0x50
 [&lt;ffffffff8163ec5f&gt;] ___sys_sendmsg+0x25f/0x270
 [&lt;ffffffff811aadad&gt;] ? handle_mm_fault+0x8dd/0x1320
 [&lt;ffffffff8178c147&gt;] ? _raw_spin_unlock+0x27/0x40
 [&lt;ffffffff810529b2&gt;] ? __do_page_fault+0x1e2/0x460
 [&lt;ffffffff81204886&gt;] ? __fget_light+0x66/0x90
 [&lt;ffffffff8163f8e2&gt;] __sys_sendmsg+0x42/0x80
 [&lt;ffffffff8163f932&gt;] SyS_sendmsg+0x12/0x20
 [&lt;ffffffff8178cb17&gt;] entry_SYSCALL_64_fastpath+0x12/0x6f
Code: 00 00 44 89 e0 e9 7c fb ff ff 4c 89 ff e8 e7 e7 ff ff 41 8b 9d 80 00 00 00 2b 5d d4 89 d8 c1 f8 03 0f b7 c0 e9 33 ff ff f
 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48
RIP  [&lt;ffffffff816a9a92&gt;] ip_do_fragment+0x892/0x8a0
 RSP &lt;ffff88006d603170&gt;

Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Signed-off-by: Joe Stringer &lt;joe@ovn.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: fix percpu memory leaks</title>
<updated>2015-11-03T03:47:14+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2015-11-02T17:03:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1d6119baf0610f813eb9d9580eb4fd16de5b4ceb'/>
<id>1d6119baf0610f813eb9d9580eb4fd16de5b4ceb</id>
<content type='text'>
This patch fixes following problems :

1) percpu_counter_init() can return an error, therefore
  init_frag_mem_limit() must propagate this error so that
  inet_frags_init_net() can do the same up to its callers.

2) If ip[46]_frags_ns_ctl_register() fail, we must unwind
   properly and free the percpu_counter.

Without this fix, we leave freed object in percpu_counters
global list (if CONFIG_HOTPLUG_CPU) leading to crashes.

This bug was detected by KASAN and syzkaller tool
(http://github.com/google/syzkaller)

Fixes: 6d7b857d541e ("net: use lib/percpu_counter API for fragmentation mem accounting")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes following problems :

1) percpu_counter_init() can return an error, therefore
  init_frag_mem_limit() must propagate this error so that
  inet_frags_init_net() can do the same up to its callers.

2) If ip[46]_frags_ns_ctl_register() fail, we must unwind
   properly and free the percpu_counter.

Without this fix, we leave freed object in percpu_counters
global list (if CONFIG_HOTPLUG_CPU) leading to crashes.

This bug was detected by KASAN and syzkaller tool
(http://github.com/google/syzkaller)

Fixes: 6d7b857d541e ("net: use lib/percpu_counter API for fragmentation mem accounting")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv4: Pass struct net into ip_defrag and ip_check_defrag</title>
<updated>2015-10-13T02:44:16+00:00</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2015-10-09T18:44:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=19bcf9f203c82c2028f5a0881b1f0690e3207190'/>
<id>19bcf9f203c82c2028f5a0881b1f0690e3207190</id>
<content type='text'>
The function ip_defrag is called on both the input and the output
paths of the networking stack.  In particular conntrack when it is
tracking outbound packets from the local machine calls ip_defrag.

So add a struct net parameter and stop making ip_defrag guess which
network namespace it needs to defragment packets in.

Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Acked-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function ip_defrag is called on both the input and the output
paths of the networking stack.  In particular conntrack when it is
tracking outbound packets from the local machine calls ip_defrag.

So add a struct net parameter and stop making ip_defrag guess which
network namespace it needs to defragment packets in.

Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Acked-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: Replace vrf_master_ifindex{, _rcu} with l3mdev equivalents</title>
<updated>2015-09-30T03:40:33+00:00</updated>
<author>
<name>David Ahern</name>
<email>dsa@cumulusnetworks.com</email>
</author>
<published>2015-09-30T03:07:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=385add906b6155e8bc64035ad56fb8ccfef925f7'/>
<id>385add906b6155e8bc64035ad56fb8ccfef925f7</id>
<content type='text'>
Replace calls to vrf_master_ifindex_rcu and vrf_master_ifindex with either
l3mdev_master_ifindex_rcu or l3mdev_master_ifindex.

The pattern:
    oif = vrf_master_ifindex(dev) ? : dev-&gt;ifindex;
is replaced with
    oif = l3mdev_fib_oif(dev);

And remove the now unused vrf macros.

Signed-off-by: David Ahern &lt;dsa@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace calls to vrf_master_ifindex_rcu and vrf_master_ifindex with either
l3mdev_master_ifindex_rcu or l3mdev_master_ifindex.

The pattern:
    oif = vrf_master_ifindex(dev) ? : dev-&gt;ifindex;
is replaced with
    oif = l3mdev_fib_oif(dev);

And remove the now unused vrf macros.

Signed-off-by: David Ahern &lt;dsa@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: Add support for VRFs to inetpeer cache</title>
<updated>2015-08-28T20:32:36+00:00</updated>
<author>
<name>David Ahern</name>
<email>dsa@cumulusnetworks.com</email>
</author>
<published>2015-08-27T23:07:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=192132b9a034d87566294be0fba5f8f75c2cf16b'/>
<id>192132b9a034d87566294be0fba5f8f75c2cf16b</id>
<content type='text'>
inetpeer caches based on address only, so duplicate IP addresses within
a namespace return the same cached entry. Enhance the ipv4 address key
to contain both the IPv4 address and VRF device index.

Signed-off-by: David Ahern &lt;dsa@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
inetpeer caches based on address only, so duplicate IP addresses within
a namespace return the same cached entry. Enhance the ipv4 address key
to contain both the IPv4 address and VRF device index.

Signed-off-by: David Ahern &lt;dsa@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: frags: Add VRF device index to cache and lookup</title>
<updated>2015-08-14T05:43:21+00:00</updated>
<author>
<name>David Ahern</name>
<email>dsa@cumulusnetworks.com</email>
</author>
<published>2015-08-13T20:59:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9972f134a273d6dc52d912a3513fa06b426de9b4'/>
<id>9972f134a273d6dc52d912a3513fa06b426de9b4</id>
<content type='text'>
Fragmentation cache uses information from the IP header to reassemble
packets. That information can be duplicated across VRFs -- same source
and destination addresses, protocol and id. Handle fragmentation with
VRFs by adding the VRF device index to entries in the cache and the
lookup arg.

Signed-off-by: David Ahern &lt;dsa@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fragmentation cache uses information from the IP header to reassemble
packets. That information can be duplicated across VRFs -- same source
and destination addresses, protocol and id. Handle fragmentation with
VRFs by adding the VRF device index to entries in the cache and the
lookup arg.

Signed-off-by: David Ahern &lt;dsa@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2015-08-01T06:52:20+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-08-01T06:52:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5510b3c2a173921374ec847848fb20b98e1c698a'/>
<id>5510b3c2a173921374ec847848fb20b98e1c698a</id>
<content type='text'>
Conflicts:
	arch/s390/net/bpf_jit_comp.c
	drivers/net/ethernet/ti/netcp_ethss.c
	net/bridge/br_multicast.c
	net/ipv4/ip_fragment.c

All four conflicts were cases of simple overlapping
changes.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	arch/s390/net/bpf_jit_comp.c
	drivers/net/ethernet/ti/netcp_ethss.c
	net/bridge/br_multicast.c
	net/ipv4/ip_fragment.c

All four conflicts were cases of simple overlapping
changes.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>inet: frags: remove INET_FRAG_EVICTED and use list_evictor for the test</title>
<updated>2015-07-27T04:00:15+00:00</updated>
<author>
<name>Nikolay Aleksandrov</name>
<email>nikolay@cumulusnetworks.com</email>
</author>
<published>2015-07-23T10:05:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=caaecdd3d3f8ec0ea9906c54b1dd8ec8316d26b9'/>
<id>caaecdd3d3f8ec0ea9906c54b1dd8ec8316d26b9</id>
<content type='text'>
We can simply remove the INET_FRAG_EVICTED flag to avoid all the flags
race conditions with the evictor and use a participation test for the
evictor list, when we're at that point (after inet_frag_kill) in the
timer there're 2 possible cases:

1. The evictor added the entry to its evictor list while the timer was
waiting for the chainlock
or
2. The timer unchained the entry and the evictor won't see it

In both cases we should be able to see list_evictor correctly due
to the sync on the chainlock.

Joint work with Florian Westphal.

Tested-by: Frank Schreuder &lt;fschreuder@transip.nl&gt;
Signed-off-by: Nikolay Aleksandrov &lt;nikolay@cumulusnetworks.com&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can simply remove the INET_FRAG_EVICTED flag to avoid all the flags
race conditions with the evictor and use a participation test for the
evictor list, when we're at that point (after inet_frag_kill) in the
timer there're 2 possible cases:

1. The evictor added the entry to its evictor list while the timer was
waiting for the chainlock
or
2. The timer unchained the entry and the evictor won't see it

In both cases we should be able to see list_evictor correctly due
to the sync on the chainlock.

Joint work with Florian Westphal.

Tested-by: Frank Schreuder &lt;fschreuder@transip.nl&gt;
Signed-off-by: Nikolay Aleksandrov &lt;nikolay@cumulusnetworks.com&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>inet: frag: change *_frag_mem_limit functions to take netns_frags as argument</title>
<updated>2015-07-27T04:00:14+00:00</updated>
<author>
<name>Florian Westphal</name>
<email>fw@strlen.de</email>
</author>
<published>2015-07-23T10:05:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0e60d245a0be7fdbb723607f1d6621007916b252'/>
<id>0e60d245a0be7fdbb723607f1d6621007916b252</id>
<content type='text'>
Followup patch will call it after inet_frag_queue was freed, so q-&gt;net
doesn't work anymore (but netf = q-&gt;net; free(q); mem_limit(netf) would).

Tested-by: Frank Schreuder &lt;fschreuder@transip.nl&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Followup patch will call it after inet_frag_queue was freed, so q-&gt;net
doesn't work anymore (but netf = q-&gt;net; free(q); mem_limit(netf) would).

Tested-by: Frank Schreuder &lt;fschreuder@transip.nl&gt;
Signed-off-by: Florian Westphal &lt;fw@strlen.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2015-07-23T07:41:16+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-07-23T07:41:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c5e40ee287db61a79af1746954ee03ebbf1ff8a3'/>
<id>c5e40ee287db61a79af1746954ee03ebbf1ff8a3</id>
<content type='text'>
Conflicts:
	net/bridge/br_mdb.c

br_mdb.c conflict was a function call being removed to fix a bug in
'net' but whose signature was changed in 'net-next'.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	net/bridge/br_mdb.c

br_mdb.c conflict was a function call being removed to fix a bug in
'net' but whose signature was changed in 'net-next'.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
