<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/net, branch v3.2.70</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>net: socket: Fix the wrong returns for recvmsg and sendmsg</title>
<updated>2015-08-06T23:32:18+00:00</updated>
<author>
<name>Junling Zheng</name>
<email>zhengjunling@huawei.com</email>
</author>
<published>2015-06-01T09:28:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f09662ea912a4b11372e5a709960fcfdc125011a'/>
<id>f09662ea912a4b11372e5a709960fcfdc125011a</id>
<content type='text'>
Based on 08adb7dabd4874cc5666b4490653b26534702ce0 upstream.

We found that after v3.10.73, recvmsg might return -EFAULT while -EINVAL
was expected.

We tested it through the recvmsg01 testcase come from LTP testsuit. It set
msg-&gt;msg_namelen to -1 and the recvmsg syscall returned errno 14, which is
unexpected (errno 22 is expected):

recvmsg01    4  TFAIL  :  invalid socket length ; returned -1 (expected -1),
errno 14 (expected 22)

Linux mainline has no this bug for commit 08adb7dab fixes it accidentally.
However, it is too large and complex to be backported to LTS 3.10.

Commit 281c9c36 (net: compat: Update get_compat_msghdr() to match
copy_msghdr_from_user() behaviour) made get_compat_msghdr() return
error if msg_sys-&gt;msg_namelen was negative, which changed the behaviors
of recvmsg and sendmsg syscall in a lib32 system:

Before commit 281c9c36, get_compat_msghdr() wouldn't fail and it would
return -EINVAL in move_addr_to_user() or somewhere if msg_sys-&gt;msg_namelen
was invalid and then syscall returned -EINVAL, which is correct.

And now, when msg_sys-&gt;msg_namelen is negative, get_compat_msghdr() will
fail and wants to return -EINVAL, however, the outer syscall will return
-EFAULT directly, which is unexpected.

This patch gets the return value of get_compat_msghdr() as well as
copy_msghdr_from_user(), then returns this expected value if
get_compat_msghdr() fails.

Fixes: 281c9c36 (net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour)
Signed-off-by: Junling Zheng &lt;zhengjunling@huawei.com&gt;
Signed-off-by: Hanbing Xu &lt;xuhanbing@huawei.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Based on 08adb7dabd4874cc5666b4490653b26534702ce0 upstream.

We found that after v3.10.73, recvmsg might return -EFAULT while -EINVAL
was expected.

We tested it through the recvmsg01 testcase come from LTP testsuit. It set
msg-&gt;msg_namelen to -1 and the recvmsg syscall returned errno 14, which is
unexpected (errno 22 is expected):

recvmsg01    4  TFAIL  :  invalid socket length ; returned -1 (expected -1),
errno 14 (expected 22)

Linux mainline has no this bug for commit 08adb7dab fixes it accidentally.
However, it is too large and complex to be backported to LTS 3.10.

Commit 281c9c36 (net: compat: Update get_compat_msghdr() to match
copy_msghdr_from_user() behaviour) made get_compat_msghdr() return
error if msg_sys-&gt;msg_namelen was negative, which changed the behaviors
of recvmsg and sendmsg syscall in a lib32 system:

Before commit 281c9c36, get_compat_msghdr() wouldn't fail and it would
return -EINVAL in move_addr_to_user() or somewhere if msg_sys-&gt;msg_namelen
was invalid and then syscall returned -EINVAL, which is correct.

And now, when msg_sys-&gt;msg_namelen is negative, get_compat_msghdr() will
fail and wants to return -EINVAL, however, the outer syscall will return
-EFAULT directly, which is unexpected.

This patch gets the return value of get_compat_msghdr() as well as
copy_msghdr_from_user(), then returns this expected value if
get_compat_msghdr() fails.

Fixes: 281c9c36 (net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour)
Signed-off-by: Junling Zheng &lt;zhengjunling@huawei.com&gt;
Signed-off-by: Hanbing Xu &lt;xuhanbing@huawei.com&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sctp: Fix race between OOTB responce and route removal</title>
<updated>2015-08-06T23:32:17+00:00</updated>
<author>
<name>Alexander Sverdlin</name>
<email>alexander.sverdlin@nokia.com</email>
</author>
<published>2015-06-29T08:41:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=117b8a10fe0c434d9043267efd51f3ba3f3d359a'/>
<id>117b8a10fe0c434d9043267efd51f3ba3f3d359a</id>
<content type='text'>
[ Upstream commit 29c4afc4e98f4dc0ea9df22c631841f9c220b944 ]

There is NULL pointer dereference possible during statistics update if the route
used for OOTB responce is removed at unfortunate time. If the route exists when
we receive OOTB packet and we finally jump into sctp_packet_transmit() to send
ABORT, but in the meantime route is removed under our feet, we take "no_route"
path and try to update stats with IP_INC_STATS(sock_net(asoc-&gt;base.sk), ...).

But sctp_ootb_pkt_new() used to prepare responce packet doesn't call
sctp_transport_set_owner() and therefore there is no asoc associated with this
packet. Probably temporary asoc just for OOTB responces is overkill, so just
introduce a check like in all other places in sctp_packet_transmit(), where
"asoc" is dereferenced.

To reproduce this, one needs to
0. ensure that sctp module is loaded (otherwise ABORT is not generated)
1. remove default route on the machine
2. while true; do
     ip route del [interface-specific route]
     ip route add [interface-specific route]
   done
3. send enough OOTB packets (i.e. HB REQs) from another host to trigger ABORT
   responce

On x86_64 the crash looks like this:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
IP: [&lt;ffffffffa05ec9ac&gt;] sctp_packet_transmit+0x63c/0x730 [sctp]
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ...
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O    4.0.5-1-ARCH #1
Hardware name: ...
task: ffffffff818124c0 ti: ffffffff81800000 task.ti: ffffffff81800000
RIP: 0010:[&lt;ffffffffa05ec9ac&gt;]  [&lt;ffffffffa05ec9ac&gt;] sctp_packet_transmit+0x63c/0x730 [sctp]
RSP: 0018:ffff880127c037b8  EFLAGS: 00010296
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000015ff66b480
RDX: 00000015ff66b400 RSI: ffff880127c17200 RDI: ffff880123403700
RBP: ffff880127c03888 R08: 0000000000017200 R09: ffffffff814625af
R10: ffffea00047e4680 R11: 00000000ffffff80 R12: ffff8800b0d38a28
R13: ffff8800b0d38a28 R14: ffff8800b3e88000 R15: ffffffffa05f24e0
FS:  0000000000000000(0000) GS:ffff880127c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000020 CR3: 00000000c855b000 CR4: 00000000000007f0
Stack:
 ffff880127c03910 ffff8800b0d38a28 ffffffff8189d240 ffff88011f91b400
 ffff880127c03828 ffffffffa05c94c5 0000000000000000 ffff8800baa1c520
 0000000000000000 0000000000000001 0000000000000000 0000000000000000
Call Trace:
 &lt;IRQ&gt;
 [&lt;ffffffffa05c94c5&gt;] ? sctp_sf_tabort_8_4_8.isra.20+0x85/0x140 [sctp]
 [&lt;ffffffffa05d6b42&gt;] ? sctp_transport_put+0x52/0x80 [sctp]
 [&lt;ffffffffa05d0bfc&gt;] sctp_do_sm+0xb8c/0x19a0 [sctp]
 [&lt;ffffffff810b0e00&gt;] ? trigger_load_balance+0x90/0x210
 [&lt;ffffffff810e0329&gt;] ? update_process_times+0x59/0x60
 [&lt;ffffffff812c7a40&gt;] ? timerqueue_add+0x60/0xb0
 [&lt;ffffffff810e0549&gt;] ? enqueue_hrtimer+0x29/0xa0
 [&lt;ffffffff8101f599&gt;] ? read_tsc+0x9/0x10
 [&lt;ffffffff8116d4b5&gt;] ? put_page+0x55/0x60
 [&lt;ffffffff810ee1ad&gt;] ? clockevents_program_event+0x6d/0x100
 [&lt;ffffffff81462b68&gt;] ? skb_free_head+0x58/0x80
 [&lt;ffffffffa029a10b&gt;] ? chksum_update+0x1b/0x27 [crc32c_generic]
 [&lt;ffffffff81283f3e&gt;] ? crypto_shash_update+0xce/0xf0
 [&lt;ffffffffa05d3993&gt;] sctp_endpoint_bh_rcv+0x113/0x280 [sctp]
 [&lt;ffffffffa05dd4e6&gt;] sctp_inq_push+0x46/0x60 [sctp]
 [&lt;ffffffffa05ed7a0&gt;] sctp_rcv+0x880/0x910 [sctp]
 [&lt;ffffffffa05ecb50&gt;] ? sctp_packet_transmit_chunk+0xb0/0xb0 [sctp]
 [&lt;ffffffffa05ecb70&gt;] ? sctp_csum_update+0x20/0x20 [sctp]
 [&lt;ffffffff814b05a5&gt;] ? ip_route_input_noref+0x235/0xd30
 [&lt;ffffffff81051d6b&gt;] ? ack_ioapic_level+0x7b/0x150
 [&lt;ffffffff814b27be&gt;] ip_local_deliver_finish+0xae/0x210
 [&lt;ffffffff814b2e15&gt;] ip_local_deliver+0x35/0x90
 [&lt;ffffffff814b2a15&gt;] ip_rcv_finish+0xf5/0x370
 [&lt;ffffffff814b3128&gt;] ip_rcv+0x2b8/0x3a0
 [&lt;ffffffff81474193&gt;] __netif_receive_skb_core+0x763/0xa50
 [&lt;ffffffff81476c28&gt;] __netif_receive_skb+0x18/0x60
 [&lt;ffffffff81476cb0&gt;] netif_receive_skb_internal+0x40/0xd0
 [&lt;ffffffff814776c8&gt;] napi_gro_receive+0xe8/0x120
 [&lt;ffffffffa03946aa&gt;] rtl8169_poll+0x2da/0x660 [r8169]
 [&lt;ffffffff8147896a&gt;] net_rx_action+0x21a/0x360
 [&lt;ffffffff81078dc1&gt;] __do_softirq+0xe1/0x2d0
 [&lt;ffffffff8107912d&gt;] irq_exit+0xad/0xb0
 [&lt;ffffffff8157d158&gt;] do_IRQ+0x58/0xf0
 [&lt;ffffffff8157b06d&gt;] common_interrupt+0x6d/0x6d
 &lt;EOI&gt;
 [&lt;ffffffff810e1218&gt;] ? hrtimer_start+0x18/0x20
 [&lt;ffffffffa05d65f9&gt;] ? sctp_transport_destroy_rcu+0x29/0x30 [sctp]
 [&lt;ffffffff81020c50&gt;] ? mwait_idle+0x60/0xa0
 [&lt;ffffffff810216ef&gt;] arch_cpu_idle+0xf/0x20
 [&lt;ffffffff810b731c&gt;] cpu_startup_entry+0x3ec/0x480
 [&lt;ffffffff8156b365&gt;] rest_init+0x85/0x90
 [&lt;ffffffff818eb035&gt;] start_kernel+0x48b/0x4ac
 [&lt;ffffffff818ea120&gt;] ? early_idt_handlers+0x120/0x120
 [&lt;ffffffff818ea339&gt;] x86_64_start_reservations+0x2a/0x2c
 [&lt;ffffffff818ea49c&gt;] x86_64_start_kernel+0x161/0x184
Code: 90 48 8b 80 b8 00 00 00 48 89 85 70 ff ff ff 48 83 bd 70 ff ff ff 00 0f 85 cd fa ff ff 48 89 df 31 db e8 18 63 e7 e0 48 8b 45 80 &lt;48&gt; 8b 40 20 48 8b 40 30 48 8b 80 68 01 00 00 65 48 ff 40 78 e9
RIP  [&lt;ffffffffa05ec9ac&gt;] sctp_packet_transmit+0x63c/0x730 [sctp]
 RSP &lt;ffff880127c037b8&gt;
CR2: 0000000000000020
---[ end trace 5aec7fd2dc983574 ]---
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
drm_kms_helper: panic occurred, switching back to text console
---[ end Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Alexander Sverdlin &lt;alexander.sverdlin@nokia.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Acked-by: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: sctp alway uses init_net]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 29c4afc4e98f4dc0ea9df22c631841f9c220b944 ]

There is NULL pointer dereference possible during statistics update if the route
used for OOTB responce is removed at unfortunate time. If the route exists when
we receive OOTB packet and we finally jump into sctp_packet_transmit() to send
ABORT, but in the meantime route is removed under our feet, we take "no_route"
path and try to update stats with IP_INC_STATS(sock_net(asoc-&gt;base.sk), ...).

But sctp_ootb_pkt_new() used to prepare responce packet doesn't call
sctp_transport_set_owner() and therefore there is no asoc associated with this
packet. Probably temporary asoc just for OOTB responces is overkill, so just
introduce a check like in all other places in sctp_packet_transmit(), where
"asoc" is dereferenced.

To reproduce this, one needs to
0. ensure that sctp module is loaded (otherwise ABORT is not generated)
1. remove default route on the machine
2. while true; do
     ip route del [interface-specific route]
     ip route add [interface-specific route]
   done
3. send enough OOTB packets (i.e. HB REQs) from another host to trigger ABORT
   responce

On x86_64 the crash looks like this:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
IP: [&lt;ffffffffa05ec9ac&gt;] sctp_packet_transmit+0x63c/0x730 [sctp]
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ...
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O    4.0.5-1-ARCH #1
Hardware name: ...
task: ffffffff818124c0 ti: ffffffff81800000 task.ti: ffffffff81800000
RIP: 0010:[&lt;ffffffffa05ec9ac&gt;]  [&lt;ffffffffa05ec9ac&gt;] sctp_packet_transmit+0x63c/0x730 [sctp]
RSP: 0018:ffff880127c037b8  EFLAGS: 00010296
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000015ff66b480
RDX: 00000015ff66b400 RSI: ffff880127c17200 RDI: ffff880123403700
RBP: ffff880127c03888 R08: 0000000000017200 R09: ffffffff814625af
R10: ffffea00047e4680 R11: 00000000ffffff80 R12: ffff8800b0d38a28
R13: ffff8800b0d38a28 R14: ffff8800b3e88000 R15: ffffffffa05f24e0
FS:  0000000000000000(0000) GS:ffff880127c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000020 CR3: 00000000c855b000 CR4: 00000000000007f0
Stack:
 ffff880127c03910 ffff8800b0d38a28 ffffffff8189d240 ffff88011f91b400
 ffff880127c03828 ffffffffa05c94c5 0000000000000000 ffff8800baa1c520
 0000000000000000 0000000000000001 0000000000000000 0000000000000000
Call Trace:
 &lt;IRQ&gt;
 [&lt;ffffffffa05c94c5&gt;] ? sctp_sf_tabort_8_4_8.isra.20+0x85/0x140 [sctp]
 [&lt;ffffffffa05d6b42&gt;] ? sctp_transport_put+0x52/0x80 [sctp]
 [&lt;ffffffffa05d0bfc&gt;] sctp_do_sm+0xb8c/0x19a0 [sctp]
 [&lt;ffffffff810b0e00&gt;] ? trigger_load_balance+0x90/0x210
 [&lt;ffffffff810e0329&gt;] ? update_process_times+0x59/0x60
 [&lt;ffffffff812c7a40&gt;] ? timerqueue_add+0x60/0xb0
 [&lt;ffffffff810e0549&gt;] ? enqueue_hrtimer+0x29/0xa0
 [&lt;ffffffff8101f599&gt;] ? read_tsc+0x9/0x10
 [&lt;ffffffff8116d4b5&gt;] ? put_page+0x55/0x60
 [&lt;ffffffff810ee1ad&gt;] ? clockevents_program_event+0x6d/0x100
 [&lt;ffffffff81462b68&gt;] ? skb_free_head+0x58/0x80
 [&lt;ffffffffa029a10b&gt;] ? chksum_update+0x1b/0x27 [crc32c_generic]
 [&lt;ffffffff81283f3e&gt;] ? crypto_shash_update+0xce/0xf0
 [&lt;ffffffffa05d3993&gt;] sctp_endpoint_bh_rcv+0x113/0x280 [sctp]
 [&lt;ffffffffa05dd4e6&gt;] sctp_inq_push+0x46/0x60 [sctp]
 [&lt;ffffffffa05ed7a0&gt;] sctp_rcv+0x880/0x910 [sctp]
 [&lt;ffffffffa05ecb50&gt;] ? sctp_packet_transmit_chunk+0xb0/0xb0 [sctp]
 [&lt;ffffffffa05ecb70&gt;] ? sctp_csum_update+0x20/0x20 [sctp]
 [&lt;ffffffff814b05a5&gt;] ? ip_route_input_noref+0x235/0xd30
 [&lt;ffffffff81051d6b&gt;] ? ack_ioapic_level+0x7b/0x150
 [&lt;ffffffff814b27be&gt;] ip_local_deliver_finish+0xae/0x210
 [&lt;ffffffff814b2e15&gt;] ip_local_deliver+0x35/0x90
 [&lt;ffffffff814b2a15&gt;] ip_rcv_finish+0xf5/0x370
 [&lt;ffffffff814b3128&gt;] ip_rcv+0x2b8/0x3a0
 [&lt;ffffffff81474193&gt;] __netif_receive_skb_core+0x763/0xa50
 [&lt;ffffffff81476c28&gt;] __netif_receive_skb+0x18/0x60
 [&lt;ffffffff81476cb0&gt;] netif_receive_skb_internal+0x40/0xd0
 [&lt;ffffffff814776c8&gt;] napi_gro_receive+0xe8/0x120
 [&lt;ffffffffa03946aa&gt;] rtl8169_poll+0x2da/0x660 [r8169]
 [&lt;ffffffff8147896a&gt;] net_rx_action+0x21a/0x360
 [&lt;ffffffff81078dc1&gt;] __do_softirq+0xe1/0x2d0
 [&lt;ffffffff8107912d&gt;] irq_exit+0xad/0xb0
 [&lt;ffffffff8157d158&gt;] do_IRQ+0x58/0xf0
 [&lt;ffffffff8157b06d&gt;] common_interrupt+0x6d/0x6d
 &lt;EOI&gt;
 [&lt;ffffffff810e1218&gt;] ? hrtimer_start+0x18/0x20
 [&lt;ffffffffa05d65f9&gt;] ? sctp_transport_destroy_rcu+0x29/0x30 [sctp]
 [&lt;ffffffff81020c50&gt;] ? mwait_idle+0x60/0xa0
 [&lt;ffffffff810216ef&gt;] arch_cpu_idle+0xf/0x20
 [&lt;ffffffff810b731c&gt;] cpu_startup_entry+0x3ec/0x480
 [&lt;ffffffff8156b365&gt;] rest_init+0x85/0x90
 [&lt;ffffffff818eb035&gt;] start_kernel+0x48b/0x4ac
 [&lt;ffffffff818ea120&gt;] ? early_idt_handlers+0x120/0x120
 [&lt;ffffffff818ea339&gt;] x86_64_start_reservations+0x2a/0x2c
 [&lt;ffffffff818ea49c&gt;] x86_64_start_kernel+0x161/0x184
Code: 90 48 8b 80 b8 00 00 00 48 89 85 70 ff ff ff 48 83 bd 70 ff ff ff 00 0f 85 cd fa ff ff 48 89 df 31 db e8 18 63 e7 e0 48 8b 45 80 &lt;48&gt; 8b 40 20 48 8b 40 30 48 8b 80 68 01 00 00 65 48 ff 40 78 e9
RIP  [&lt;ffffffffa05ec9ac&gt;] sctp_packet_transmit+0x63c/0x730 [sctp]
 RSP &lt;ffff880127c037b8&gt;
CR2: 0000000000000020
---[ end trace 5aec7fd2dc983574 ]---
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
drm_kms_helper: panic occurred, switching back to text console
---[ end Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Alexander Sverdlin &lt;alexander.sverdlin@nokia.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Acked-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Acked-by: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: sctp alway uses init_net]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>neigh: do not modify unlinked entries</title>
<updated>2015-08-06T23:32:17+00:00</updated>
<author>
<name>Julian Anastasov</name>
<email>ja@ssi.bg</email>
</author>
<published>2015-06-16T19:56:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=818ffedfbdf96e1d1ca2f1a4b39ad58cb07e2cfc'/>
<id>818ffedfbdf96e1d1ca2f1a4b39ad58cb07e2cfc</id>
<content type='text'>
[ Upstream commit 2c51a97f76d20ebf1f50fef908b986cb051fdff9 ]

The lockless lookups can return entry that is unlinked.
Sometimes they get reference before last neigh_cleanup_and_release,
sometimes they do not need reference. Later, any
modification attempts may result in the following problems:

1. entry is not destroyed immediately because neigh_update
can start the timer for dead entry, eg. on change to NUD_REACHABLE
state. As result, entry lives for some time but is invisible
and out of control.

2. __neigh_event_send can run in parallel with neigh_destroy
while refcnt=0 but if timer is started and expired refcnt can
reach 0 for second time leading to second neigh_destroy and
possible crash.

Thanks to Eric Dumazet and Ying Xue for their work and analyze
on the __neigh_event_send change.

Fixes: 767e97e1e0db ("neigh: RCU conversion of struct neighbour")
Fixes: a263b3093641 ("ipv4: Make neigh lookups directly in output packet path.")
Fixes: 6fd6ce2056de ("ipv6: Do not depend on rt-&gt;n in ip6_finish_output2().")
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: drop change to __neigh_set_probe_once() which
 we don't have]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 2c51a97f76d20ebf1f50fef908b986cb051fdff9 ]

The lockless lookups can return entry that is unlinked.
Sometimes they get reference before last neigh_cleanup_and_release,
sometimes they do not need reference. Later, any
modification attempts may result in the following problems:

1. entry is not destroyed immediately because neigh_update
can start the timer for dead entry, eg. on change to NUD_REACHABLE
state. As result, entry lives for some time but is invisible
and out of control.

2. __neigh_event_send can run in parallel with neigh_destroy
while refcnt=0 but if timer is started and expired refcnt can
reach 0 for second time leading to second neigh_destroy and
possible crash.

Thanks to Eric Dumazet and Ying Xue for their work and analyze
on the __neigh_event_send change.

Fixes: 767e97e1e0db ("neigh: RCU conversion of struct neighbour")
Fixes: a263b3093641 ("ipv4: Make neigh lookups directly in output packet path.")
Fixes: 6fd6ce2056de ("ipv6: Do not depend on rt-&gt;n in ip6_finish_output2().")
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Ying Xue &lt;ying.xue@windriver.com&gt;
Signed-off-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: drop change to __neigh_set_probe_once() which
 we don't have]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>packet: avoid out of bounds read in round robin fanout</title>
<updated>2015-08-06T23:32:17+00:00</updated>
<author>
<name>Willem de Bruijn</name>
<email>willemb@google.com</email>
</author>
<published>2015-06-17T19:59:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d77456d7361a00d6a4989f8230570e46e53b19eb'/>
<id>d77456d7361a00d6a4989f8230570e46e53b19eb</id>
<content type='text'>
[ Upstream commit 468479e6043c84f5a65299cc07cb08a22a28c2b1 ]

PACKET_FANOUT_LB computes f-&gt;rr_cur such that it is modulo
f-&gt;num_members. It returns the old value unconditionally, but
f-&gt;num_members may have changed since the last store. Ensure
that the return value is always &lt; num.

When modifying the logic, simplify it further by replacing the loop
with an unconditional atomic increment.

Fixes: dc99f600698d ("packet: Add fanout support.")
Suggested-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Willem de Bruijn &lt;willemb@google.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - Demux functions return a sock pointer, not an index]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 468479e6043c84f5a65299cc07cb08a22a28c2b1 ]

PACKET_FANOUT_LB computes f-&gt;rr_cur such that it is modulo
f-&gt;num_members. It returns the old value unconditionally, but
f-&gt;num_members may have changed since the last store. Ensure
that the return value is always &lt; num.

When modifying the logic, simplify it further by replacing the loop
with an unconditional atomic increment.

Fixes: dc99f600698d ("packet: Add fanout support.")
Suggested-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: Willem de Bruijn &lt;willemb@google.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Adjust context
 - Demux functions return a sock pointer, not an index]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>packet: read num_members once in packet_rcv_fanout()</title>
<updated>2015-08-06T23:32:17+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2015-06-16T14:59:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f5a27902fd01ffc4b379101c64ac3a8cb69495bd'/>
<id>f5a27902fd01ffc4b379101c64ac3a8cb69495bd</id>
<content type='text'>
[ Upstream commit f98f4514d07871da7a113dd9e3e330743fd70ae4 ]

We need to tell compiler it must not read f-&gt;num_members multiple
times. Otherwise testing if num is not zero is flaky, and we could
attempt an invalid divide by 0 in fanout_demux_cpu()

Note bug was present in packet_rcv_fanout_hash() and
packet_rcv_fanout_lb() but final 3.1 had a simple location
after commit 95ec3eb417115fb ("packet: Add 'cpu' fanout policy.")

Fixes: dc99f600698dc ("packet: Add fanout support.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit f98f4514d07871da7a113dd9e3e330743fd70ae4 ]

We need to tell compiler it must not read f-&gt;num_members multiple
times. Otherwise testing if num is not zero is flaky, and we could
attempt an invalid divide by 0 in fanout_demux_cpu()

Note bug was present in packet_rcv_fanout_hash() and
packet_rcv_fanout_lb() but final 3.1 had a simple location
after commit 95ec3eb417115fb ("packet: Add 'cpu' fanout policy.")

Fixes: dc99f600698dc ("packet: Add fanout support.")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bridge: fix br_stp_set_bridge_priority race conditions</title>
<updated>2015-08-06T23:32:17+00:00</updated>
<author>
<name>Nikolay Aleksandrov</name>
<email>razor@blackwall.org</email>
</author>
<published>2015-06-15T17:28:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=41431e402fc405dcef9a468a815c68b322ad0e62'/>
<id>41431e402fc405dcef9a468a815c68b322ad0e62</id>
<content type='text'>
[ Upstream commit 2dab80a8b486f02222a69daca6859519e05781d9 ]

After the -&gt;set() spinlocks were removed br_stp_set_bridge_priority
was left running without any protection when used via sysfs. It can
race with port add/del and could result in use-after-free cases and
corrupted lists. Tested by running port add/del in a loop with stp
enabled while setting priority in a loop, crashes are easily
reproducible.
The spinlocks around sysfs -&gt;set() were removed in commit:
14f98f258f19 ("bridge: range check STP parameters")
There's also a race condition in the netlink priority support that is
fixed by this change, but it was introduced recently and the fixes tag
covers it, just in case it's needed the commit is:
af615762e972 ("bridge: add ageing_time, stp_state, priority over netlink")

Signed-off-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Fixes: 14f98f258f19 ("bridge: range check STP parameters")
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 2dab80a8b486f02222a69daca6859519e05781d9 ]

After the -&gt;set() spinlocks were removed br_stp_set_bridge_priority
was left running without any protection when used via sysfs. It can
race with port add/del and could result in use-after-free cases and
corrupted lists. Tested by running port add/del in a loop with stp
enabled while setting priority in a loop, crashes are easily
reproducible.
The spinlocks around sysfs -&gt;set() were removed in commit:
14f98f258f19 ("bridge: range check STP parameters")
There's also a race condition in the netlink priority support that is
fixed by this change, but it was introduced recently and the fixes tag
covers it, just in case it's needed the commit is:
af615762e972 ("bridge: add ageing_time, stp_state, priority over netlink")

Signed-off-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Fixes: 14f98f258f19 ("bridge: range check STP parameters")
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>unix/caif: sk_socket can disappear when state is unlocked</title>
<updated>2015-08-06T23:32:16+00:00</updated>
<author>
<name>Mark Salyzyn</name>
<email>salyzyn@android.com</email>
</author>
<published>2015-05-26T15:22:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f25e48cb938644c632f140c8bc92e0c4210ce20b'/>
<id>f25e48cb938644c632f140c8bc92e0c4210ce20b</id>
<content type='text'>
[ Upstream commit b48732e4a48d80ed4a14812f0bab09560846514e ]

got a rare NULL pointer dereference in clear_bit

Signed-off-by: Mark Salyzyn &lt;salyzyn@android.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
----
v2: switch to sock_flag(sk, SOCK_DEAD) and added net/caif/caif_socket.c
v3: return -ECONNRESET in upstream caller of wait function for SOCK_DEAD
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit b48732e4a48d80ed4a14812f0bab09560846514e ]

got a rare NULL pointer dereference in clear_bit

Signed-off-by: Mark Salyzyn &lt;salyzyn@android.com&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
----
v2: switch to sock_flag(sk, SOCK_DEAD) and added net/caif/caif_socket.c
v3: return -ECONNRESET in upstream caller of wait function for SOCK_DEAD
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipvs: kernel oops - do_ip_vs_get_ctl</title>
<updated>2015-08-06T23:32:16+00:00</updated>
<author>
<name>Hans Schillstrom</name>
<email>hans.schillstrom@ericsson.com</email>
</author>
<published>2012-04-26T05:47:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=29f163de8d5660ab388f97e47b9b1c75c87f9c6b'/>
<id>29f163de8d5660ab388f97e47b9b1c75c87f9c6b</id>
<content type='text'>
commit 8537de8a7ab6681cc72fb0411ab1ba7fdba62dd0 upstream.

Change order of init so netns init is ready
when register ioctl and netlink.

Ver2
	Whitespace fixes and __init added.

Reported-by: "Ryan O'Hara" &lt;rohara@redhat.com&gt;
Signed-off-by: Hans Schillstrom &lt;hans.schillstrom@ericsson.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Signed-off-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Andreas Unterkircher &lt;unki@netshadow.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 8537de8a7ab6681cc72fb0411ab1ba7fdba62dd0 upstream.

Change order of init so netns init is ready
when register ioctl and netlink.

Ver2
	Whitespace fixes and __init added.

Reported-by: "Ryan O'Hara" &lt;rohara@redhat.com&gt;
Signed-off-by: Hans Schillstrom &lt;hans.schillstrom@ericsson.com&gt;
Acked-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Signed-off-by: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Signed-off-by: Simon Horman &lt;horms@verge.net.au&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Andreas Unterkircher &lt;unki@netshadow.at&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sctp: fix ASCONF list handling</title>
<updated>2015-08-06T23:32:15+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2015-06-12T13:16:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=001b7cc921ce608997f2796ecf95fe05b7288457'/>
<id>001b7cc921ce608997f2796ecf95fe05b7288457</id>
<content type='text'>
commit 2d45a02d0166caf2627fe91897c6ffc3b19514c4 upstream.

-&gt;auto_asconf_splist is per namespace and mangled by functions like
sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization.

Also, the call to inet_sk_copy_descendant() was backuping
-&gt;auto_asconf_list through the copy but was not honoring
-&gt;do_auto_asconf, which could lead to list corruption if it was
different between both sockets.

This commit thus fixes the list handling by using -&gt;addr_wq_lock
spinlock to protect the list. A special handling is done upon socket
creation and destruction for that. Error handlig on sctp_init_sock()
will never return an error after having initialized asconf, so
sctp_destroy_sock() can be called without addrq_wq_lock. The lock now
will be take on sctp_close_sock(), before locking the socket, so we
don't do it in inverse order compared to sctp_addr_wq_timeout_handler().

Instead of taking the lock on sctp_sock_migrate() for copying and
restoring the list values, it's preferred to avoid rewritting it by
implementing sctp_copy_descendant().

Issue was found with a test application that kept flipping sysctl
default_auto_asconf on and off, but one could trigger it by issuing
simultaneous setsockopt() calls on multiple sockets or by
creating/destroying sockets fast enough. This is only triggerable
locally.

Fixes: 9f7d653b67ae ("sctp: Add Auto-ASCONF support (core).")
Reported-by: Ji Jianwen &lt;jiji@redhat.com&gt;
Suggested-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Suggested-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Adjust filename, context
 - Most per-netns state is global]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2d45a02d0166caf2627fe91897c6ffc3b19514c4 upstream.

-&gt;auto_asconf_splist is per namespace and mangled by functions like
sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization.

Also, the call to inet_sk_copy_descendant() was backuping
-&gt;auto_asconf_list through the copy but was not honoring
-&gt;do_auto_asconf, which could lead to list corruption if it was
different between both sockets.

This commit thus fixes the list handling by using -&gt;addr_wq_lock
spinlock to protect the list. A special handling is done upon socket
creation and destruction for that. Error handlig on sctp_init_sock()
will never return an error after having initialized asconf, so
sctp_destroy_sock() can be called without addrq_wq_lock. The lock now
will be take on sctp_close_sock(), before locking the socket, so we
don't do it in inverse order compared to sctp_addr_wq_timeout_handler().

Instead of taking the lock on sctp_sock_migrate() for copying and
restoring the list values, it's preferred to avoid rewritting it by
implementing sctp_copy_descendant().

Issue was found with a test application that kept flipping sysctl
default_auto_asconf on and off, but one could trigger it by issuing
simultaneous setsockopt() calls on multiple sockets or by
creating/destroying sockets fast enough. This is only triggerable
locally.

Fixes: 9f7d653b67ae ("sctp: Add Auto-ASCONF support (core).")
Reported-by: Ji Jianwen &lt;jiji@redhat.com&gt;
Suggested-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Suggested-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Acked-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Adjust filename, context
 - Most per-netns state is global]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>udp: fix behavior of wrong checksums</title>
<updated>2015-08-06T23:32:15+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2015-05-30T16:16:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=556574d97b6e0c2970b7e5ab693bcf35f73195fa'/>
<id>556574d97b6e0c2970b7e5ab693bcf35f73195fa</id>
<content type='text'>
commit beb39db59d14990e401e235faf66a6b9b31240b0 upstream.

We have two problems in UDP stack related to bogus checksums :

1) We return -EAGAIN to application even if receive queue is not empty.
   This breaks applications using edge trigger epoll()

2) Under UDP flood, we can loop forever without yielding to other
   processes, potentially hanging the host, especially on non SMP.

This patch is an attempt to make things better.

We might in the future add extra support for rt applications
wanting to better control time spent doing a recv() in a hostile
environment. For example we could validate checksums before queuing
packets in socket receive queue.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit beb39db59d14990e401e235faf66a6b9b31240b0 upstream.

We have two problems in UDP stack related to bogus checksums :

1) We return -EAGAIN to application even if receive queue is not empty.
   This breaks applications using edge trigger epoll()

2) Under UDP flood, we can loop forever without yielding to other
   processes, potentially hanging the host, especially on non SMP.

This patch is an attempt to make things better.

We might in the future add extra support for rt applications
wanting to better control time spent doing a recv() in a hostile
environment. For example we could validate checksums before queuing
packets in socket receive queue.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
