<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/net, branch v3.2.88</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()</title>
<updated>2017-04-04T21:18:32+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2016-11-18T21:13:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2147a17048314f069838aace1d08b8c719448b50'/>
<id>2147a17048314f069838aace1d08b8c719448b50</id>
<content type='text'>
commit 32c231164b762dddefa13af5a0101032c70b50ef upstream.

Lock socket before checking the SOCK_ZAPPED flag in l2tp_ip6_bind().
Without lock, a concurrent call could modify the socket flags between
the sock_flag(sk, SOCK_ZAPPED) test and the lock_sock() call. This way,
a socket could be inserted twice in l2tp_ip6_bind_table. Releasing it
would then leave a stale pointer there, generating use-after-free
errors when walking through the list or modifying adjacent entries.

BUG: KASAN: use-after-free in l2tp_ip6_close+0x22e/0x290 at addr ffff8800081b0ed8
Write of size 8 by task syz-executor/10987
CPU: 0 PID: 10987 Comm: syz-executor Not tainted 4.8.0+ #39
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 ffff880031d97838 ffffffff829f835b ffff88001b5a1640 ffff8800081b0ec0
 ffff8800081b15a0 ffff8800081b6d20 ffff880031d97860 ffffffff8174d3cc
 ffff880031d978f0 ffff8800081b0e80 ffff88001b5a1640 ffff880031d978e0
Call Trace:
 [&lt;ffffffff829f835b&gt;] dump_stack+0xb3/0x118 lib/dump_stack.c:15
 [&lt;ffffffff8174d3cc&gt;] kasan_object_err+0x1c/0x70 mm/kasan/report.c:156
 [&lt;     inline     &gt;] print_address_description mm/kasan/report.c:194
 [&lt;ffffffff8174d666&gt;] kasan_report_error+0x1f6/0x4d0 mm/kasan/report.c:283
 [&lt;     inline     &gt;] kasan_report mm/kasan/report.c:303
 [&lt;ffffffff8174db7e&gt;] __asan_report_store8_noabort+0x3e/0x40 mm/kasan/report.c:329
 [&lt;     inline     &gt;] __write_once_size ./include/linux/compiler.h:249
 [&lt;     inline     &gt;] __hlist_del ./include/linux/list.h:622
 [&lt;     inline     &gt;] hlist_del_init ./include/linux/list.h:637
 [&lt;ffffffff8579047e&gt;] l2tp_ip6_close+0x22e/0x290 net/l2tp/l2tp_ip6.c:239
 [&lt;ffffffff850b2dfd&gt;] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
 [&lt;ffffffff851dc5a0&gt;] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
 [&lt;ffffffff84c4581d&gt;] sock_release+0x8d/0x1d0 net/socket.c:570
 [&lt;ffffffff84c45976&gt;] sock_close+0x16/0x20 net/socket.c:1017
 [&lt;ffffffff817a108c&gt;] __fput+0x28c/0x780 fs/file_table.c:208
 [&lt;ffffffff817a1605&gt;] ____fput+0x15/0x20 fs/file_table.c:244
 [&lt;ffffffff813774f9&gt;] task_work_run+0xf9/0x170
 [&lt;ffffffff81324aae&gt;] do_exit+0x85e/0x2a00
 [&lt;ffffffff81326dc8&gt;] do_group_exit+0x108/0x330
 [&lt;ffffffff81348cf7&gt;] get_signal+0x617/0x17a0 kernel/signal.c:2307
 [&lt;ffffffff811b49af&gt;] do_signal+0x7f/0x18f0
 [&lt;ffffffff810039bf&gt;] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
 [&lt;     inline     &gt;] prepare_exit_to_usermode arch/x86/entry/common.c:190
 [&lt;ffffffff81006060&gt;] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [&lt;ffffffff85e4d726&gt;] entry_SYSCALL_64_fastpath+0xc4/0xc6
Object at ffff8800081b0ec0, in cache L2TP/IPv6 size: 1448
Allocated:
PID = 10987
 [ 1116.897025] [&lt;ffffffff811ddcb6&gt;] save_stack_trace+0x16/0x20
 [ 1116.897025] [&lt;ffffffff8174c736&gt;] save_stack+0x46/0xd0
 [ 1116.897025] [&lt;ffffffff8174c9ad&gt;] kasan_kmalloc+0xad/0xe0
 [ 1116.897025] [&lt;ffffffff8174cee2&gt;] kasan_slab_alloc+0x12/0x20
 [ 1116.897025] [&lt;     inline     &gt;] slab_post_alloc_hook mm/slab.h:417
 [ 1116.897025] [&lt;     inline     &gt;] slab_alloc_node mm/slub.c:2708
 [ 1116.897025] [&lt;     inline     &gt;] slab_alloc mm/slub.c:2716
 [ 1116.897025] [&lt;ffffffff817476a8&gt;] kmem_cache_alloc+0xc8/0x2b0 mm/slub.c:2721
 [ 1116.897025] [&lt;ffffffff84c4f6a9&gt;] sk_prot_alloc+0x69/0x2b0 net/core/sock.c:1326
 [ 1116.897025] [&lt;ffffffff84c58ac8&gt;] sk_alloc+0x38/0xae0 net/core/sock.c:1388
 [ 1116.897025] [&lt;ffffffff851ddf67&gt;] inet6_create+0x2d7/0x1000 net/ipv6/af_inet6.c:182
 [ 1116.897025] [&lt;ffffffff84c4af7b&gt;] __sock_create+0x37b/0x640 net/socket.c:1153
 [ 1116.897025] [&lt;     inline     &gt;] sock_create net/socket.c:1193
 [ 1116.897025] [&lt;     inline     &gt;] SYSC_socket net/socket.c:1223
 [ 1116.897025] [&lt;ffffffff84c4b46f&gt;] SyS_socket+0xef/0x1b0 net/socket.c:1203
 [ 1116.897025] [&lt;ffffffff85e4d685&gt;] entry_SYSCALL_64_fastpath+0x23/0xc6
Freed:
PID = 10987
 [ 1116.897025] [&lt;ffffffff811ddcb6&gt;] save_stack_trace+0x16/0x20
 [ 1116.897025] [&lt;ffffffff8174c736&gt;] save_stack+0x46/0xd0
 [ 1116.897025] [&lt;ffffffff8174cf61&gt;] kasan_slab_free+0x71/0xb0
 [ 1116.897025] [&lt;     inline     &gt;] slab_free_hook mm/slub.c:1352
 [ 1116.897025] [&lt;     inline     &gt;] slab_free_freelist_hook mm/slub.c:1374
 [ 1116.897025] [&lt;     inline     &gt;] slab_free mm/slub.c:2951
 [ 1116.897025] [&lt;ffffffff81748b28&gt;] kmem_cache_free+0xc8/0x330 mm/slub.c:2973
 [ 1116.897025] [&lt;     inline     &gt;] sk_prot_free net/core/sock.c:1369
 [ 1116.897025] [&lt;ffffffff84c541eb&gt;] __sk_destruct+0x32b/0x4f0 net/core/sock.c:1444
 [ 1116.897025] [&lt;ffffffff84c5aca4&gt;] sk_destruct+0x44/0x80 net/core/sock.c:1452
 [ 1116.897025] [&lt;ffffffff84c5ad33&gt;] __sk_free+0x53/0x220 net/core/sock.c:1460
 [ 1116.897025] [&lt;ffffffff84c5af23&gt;] sk_free+0x23/0x30 net/core/sock.c:1471
 [ 1116.897025] [&lt;ffffffff84c5cb6c&gt;] sk_common_release+0x28c/0x3e0 ./include/net/sock.h:1589
 [ 1116.897025] [&lt;ffffffff8579044e&gt;] l2tp_ip6_close+0x1fe/0x290 net/l2tp/l2tp_ip6.c:243
 [ 1116.897025] [&lt;ffffffff850b2dfd&gt;] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
 [ 1116.897025] [&lt;ffffffff851dc5a0&gt;] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
 [ 1116.897025] [&lt;ffffffff84c4581d&gt;] sock_release+0x8d/0x1d0 net/socket.c:570
 [ 1116.897025] [&lt;ffffffff84c45976&gt;] sock_close+0x16/0x20 net/socket.c:1017
 [ 1116.897025] [&lt;ffffffff817a108c&gt;] __fput+0x28c/0x780 fs/file_table.c:208
 [ 1116.897025] [&lt;ffffffff817a1605&gt;] ____fput+0x15/0x20 fs/file_table.c:244
 [ 1116.897025] [&lt;ffffffff813774f9&gt;] task_work_run+0xf9/0x170
 [ 1116.897025] [&lt;ffffffff81324aae&gt;] do_exit+0x85e/0x2a00
 [ 1116.897025] [&lt;ffffffff81326dc8&gt;] do_group_exit+0x108/0x330
 [ 1116.897025] [&lt;ffffffff81348cf7&gt;] get_signal+0x617/0x17a0 kernel/signal.c:2307
 [ 1116.897025] [&lt;ffffffff811b49af&gt;] do_signal+0x7f/0x18f0
 [ 1116.897025] [&lt;ffffffff810039bf&gt;] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
 [ 1116.897025] [&lt;     inline     &gt;] prepare_exit_to_usermode arch/x86/entry/common.c:190
 [ 1116.897025] [&lt;ffffffff81006060&gt;] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [ 1116.897025] [&lt;ffffffff85e4d726&gt;] entry_SYSCALL_64_fastpath+0xc4/0xc6
Memory state around the buggy address:
 ffff8800081b0d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8800081b0e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt;ffff8800081b0e80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                    ^
 ffff8800081b0f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8800081b0f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

==================================================================

The same issue exists with l2tp_ip_bind() and l2tp_ip_bind_table.

Fixes: c51ce49735c1 ("l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case")
Reported-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Reported-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Tested-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: drop IPv6 changes]
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 32c231164b762dddefa13af5a0101032c70b50ef upstream.

Lock socket before checking the SOCK_ZAPPED flag in l2tp_ip6_bind().
Without lock, a concurrent call could modify the socket flags between
the sock_flag(sk, SOCK_ZAPPED) test and the lock_sock() call. This way,
a socket could be inserted twice in l2tp_ip6_bind_table. Releasing it
would then leave a stale pointer there, generating use-after-free
errors when walking through the list or modifying adjacent entries.

BUG: KASAN: use-after-free in l2tp_ip6_close+0x22e/0x290 at addr ffff8800081b0ed8
Write of size 8 by task syz-executor/10987
CPU: 0 PID: 10987 Comm: syz-executor Not tainted 4.8.0+ #39
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 ffff880031d97838 ffffffff829f835b ffff88001b5a1640 ffff8800081b0ec0
 ffff8800081b15a0 ffff8800081b6d20 ffff880031d97860 ffffffff8174d3cc
 ffff880031d978f0 ffff8800081b0e80 ffff88001b5a1640 ffff880031d978e0
Call Trace:
 [&lt;ffffffff829f835b&gt;] dump_stack+0xb3/0x118 lib/dump_stack.c:15
 [&lt;ffffffff8174d3cc&gt;] kasan_object_err+0x1c/0x70 mm/kasan/report.c:156
 [&lt;     inline     &gt;] print_address_description mm/kasan/report.c:194
 [&lt;ffffffff8174d666&gt;] kasan_report_error+0x1f6/0x4d0 mm/kasan/report.c:283
 [&lt;     inline     &gt;] kasan_report mm/kasan/report.c:303
 [&lt;ffffffff8174db7e&gt;] __asan_report_store8_noabort+0x3e/0x40 mm/kasan/report.c:329
 [&lt;     inline     &gt;] __write_once_size ./include/linux/compiler.h:249
 [&lt;     inline     &gt;] __hlist_del ./include/linux/list.h:622
 [&lt;     inline     &gt;] hlist_del_init ./include/linux/list.h:637
 [&lt;ffffffff8579047e&gt;] l2tp_ip6_close+0x22e/0x290 net/l2tp/l2tp_ip6.c:239
 [&lt;ffffffff850b2dfd&gt;] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
 [&lt;ffffffff851dc5a0&gt;] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
 [&lt;ffffffff84c4581d&gt;] sock_release+0x8d/0x1d0 net/socket.c:570
 [&lt;ffffffff84c45976&gt;] sock_close+0x16/0x20 net/socket.c:1017
 [&lt;ffffffff817a108c&gt;] __fput+0x28c/0x780 fs/file_table.c:208
 [&lt;ffffffff817a1605&gt;] ____fput+0x15/0x20 fs/file_table.c:244
 [&lt;ffffffff813774f9&gt;] task_work_run+0xf9/0x170
 [&lt;ffffffff81324aae&gt;] do_exit+0x85e/0x2a00
 [&lt;ffffffff81326dc8&gt;] do_group_exit+0x108/0x330
 [&lt;ffffffff81348cf7&gt;] get_signal+0x617/0x17a0 kernel/signal.c:2307
 [&lt;ffffffff811b49af&gt;] do_signal+0x7f/0x18f0
 [&lt;ffffffff810039bf&gt;] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
 [&lt;     inline     &gt;] prepare_exit_to_usermode arch/x86/entry/common.c:190
 [&lt;ffffffff81006060&gt;] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [&lt;ffffffff85e4d726&gt;] entry_SYSCALL_64_fastpath+0xc4/0xc6
Object at ffff8800081b0ec0, in cache L2TP/IPv6 size: 1448
Allocated:
PID = 10987
 [ 1116.897025] [&lt;ffffffff811ddcb6&gt;] save_stack_trace+0x16/0x20
 [ 1116.897025] [&lt;ffffffff8174c736&gt;] save_stack+0x46/0xd0
 [ 1116.897025] [&lt;ffffffff8174c9ad&gt;] kasan_kmalloc+0xad/0xe0
 [ 1116.897025] [&lt;ffffffff8174cee2&gt;] kasan_slab_alloc+0x12/0x20
 [ 1116.897025] [&lt;     inline     &gt;] slab_post_alloc_hook mm/slab.h:417
 [ 1116.897025] [&lt;     inline     &gt;] slab_alloc_node mm/slub.c:2708
 [ 1116.897025] [&lt;     inline     &gt;] slab_alloc mm/slub.c:2716
 [ 1116.897025] [&lt;ffffffff817476a8&gt;] kmem_cache_alloc+0xc8/0x2b0 mm/slub.c:2721
 [ 1116.897025] [&lt;ffffffff84c4f6a9&gt;] sk_prot_alloc+0x69/0x2b0 net/core/sock.c:1326
 [ 1116.897025] [&lt;ffffffff84c58ac8&gt;] sk_alloc+0x38/0xae0 net/core/sock.c:1388
 [ 1116.897025] [&lt;ffffffff851ddf67&gt;] inet6_create+0x2d7/0x1000 net/ipv6/af_inet6.c:182
 [ 1116.897025] [&lt;ffffffff84c4af7b&gt;] __sock_create+0x37b/0x640 net/socket.c:1153
 [ 1116.897025] [&lt;     inline     &gt;] sock_create net/socket.c:1193
 [ 1116.897025] [&lt;     inline     &gt;] SYSC_socket net/socket.c:1223
 [ 1116.897025] [&lt;ffffffff84c4b46f&gt;] SyS_socket+0xef/0x1b0 net/socket.c:1203
 [ 1116.897025] [&lt;ffffffff85e4d685&gt;] entry_SYSCALL_64_fastpath+0x23/0xc6
Freed:
PID = 10987
 [ 1116.897025] [&lt;ffffffff811ddcb6&gt;] save_stack_trace+0x16/0x20
 [ 1116.897025] [&lt;ffffffff8174c736&gt;] save_stack+0x46/0xd0
 [ 1116.897025] [&lt;ffffffff8174cf61&gt;] kasan_slab_free+0x71/0xb0
 [ 1116.897025] [&lt;     inline     &gt;] slab_free_hook mm/slub.c:1352
 [ 1116.897025] [&lt;     inline     &gt;] slab_free_freelist_hook mm/slub.c:1374
 [ 1116.897025] [&lt;     inline     &gt;] slab_free mm/slub.c:2951
 [ 1116.897025] [&lt;ffffffff81748b28&gt;] kmem_cache_free+0xc8/0x330 mm/slub.c:2973
 [ 1116.897025] [&lt;     inline     &gt;] sk_prot_free net/core/sock.c:1369
 [ 1116.897025] [&lt;ffffffff84c541eb&gt;] __sk_destruct+0x32b/0x4f0 net/core/sock.c:1444
 [ 1116.897025] [&lt;ffffffff84c5aca4&gt;] sk_destruct+0x44/0x80 net/core/sock.c:1452
 [ 1116.897025] [&lt;ffffffff84c5ad33&gt;] __sk_free+0x53/0x220 net/core/sock.c:1460
 [ 1116.897025] [&lt;ffffffff84c5af23&gt;] sk_free+0x23/0x30 net/core/sock.c:1471
 [ 1116.897025] [&lt;ffffffff84c5cb6c&gt;] sk_common_release+0x28c/0x3e0 ./include/net/sock.h:1589
 [ 1116.897025] [&lt;ffffffff8579044e&gt;] l2tp_ip6_close+0x1fe/0x290 net/l2tp/l2tp_ip6.c:243
 [ 1116.897025] [&lt;ffffffff850b2dfd&gt;] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
 [ 1116.897025] [&lt;ffffffff851dc5a0&gt;] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
 [ 1116.897025] [&lt;ffffffff84c4581d&gt;] sock_release+0x8d/0x1d0 net/socket.c:570
 [ 1116.897025] [&lt;ffffffff84c45976&gt;] sock_close+0x16/0x20 net/socket.c:1017
 [ 1116.897025] [&lt;ffffffff817a108c&gt;] __fput+0x28c/0x780 fs/file_table.c:208
 [ 1116.897025] [&lt;ffffffff817a1605&gt;] ____fput+0x15/0x20 fs/file_table.c:244
 [ 1116.897025] [&lt;ffffffff813774f9&gt;] task_work_run+0xf9/0x170
 [ 1116.897025] [&lt;ffffffff81324aae&gt;] do_exit+0x85e/0x2a00
 [ 1116.897025] [&lt;ffffffff81326dc8&gt;] do_group_exit+0x108/0x330
 [ 1116.897025] [&lt;ffffffff81348cf7&gt;] get_signal+0x617/0x17a0 kernel/signal.c:2307
 [ 1116.897025] [&lt;ffffffff811b49af&gt;] do_signal+0x7f/0x18f0
 [ 1116.897025] [&lt;ffffffff810039bf&gt;] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
 [ 1116.897025] [&lt;     inline     &gt;] prepare_exit_to_usermode arch/x86/entry/common.c:190
 [ 1116.897025] [&lt;ffffffff81006060&gt;] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [ 1116.897025] [&lt;ffffffff85e4d726&gt;] entry_SYSCALL_64_fastpath+0xc4/0xc6
Memory state around the buggy address:
 ffff8800081b0d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8800081b0e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt;ffff8800081b0e80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                    ^
 ffff8800081b0f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8800081b0f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

==================================================================

The same issue exists with l2tp_ip_bind() and l2tp_ip_bind_table.

Fixes: c51ce49735c1 ("l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case")
Reported-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Reported-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Tested-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2: drop IPv6 changes]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv4: keep skb-&gt;dst around in presence of IP options</title>
<updated>2017-04-04T21:18:32+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2017-03-21T04:23:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6892986c7db05c281322f1f8870f5a46d4080e99'/>
<id>6892986c7db05c281322f1f8870f5a46d4080e99</id>
<content type='text'>
Upstream commit 34b2cef20f19c87999fff3da4071e66937db9644
("ipv4: keep skb-&gt;dst around in presence of IP options") incorrectly
root caused commit d826eb14ecef ("ipv4: PKTINFO doesnt need dst
reference") as bug origin.

This patch should fix the issue for 3.2.xx stable kernels, since IPv4
options seem to get more traction these days, after years of oblivion ;)

Fixes: f84af32cbca70 ("net: ip_queue_rcv_skb() helper"))
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Anarcheuz Fritz &lt;anarcheuz@gmail.com&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 34b2cef20f19c87999fff3da4071e66937db9644
("ipv4: keep skb-&gt;dst around in presence of IP options") incorrectly
root caused commit d826eb14ecef ("ipv4: PKTINFO doesnt need dst
reference") as bug origin.

This patch should fix the issue for 3.2.xx stable kernels, since IPv4
options seem to get more traction these days, after years of oblivion ;)

Fixes: f84af32cbca70 ("net: ip_queue_rcv_skb() helper"))
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Anarcheuz Fritz &lt;anarcheuz@gmail.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sctp: deny peeloff operation on asocs with threads sleeping on it</title>
<updated>2017-03-16T02:18:58+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2017-02-23T12:31:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6c24f53714319676adf7ab0d2d081e4b9de35bad'/>
<id>6c24f53714319676adf7ab0d2d081e4b9de35bad</id>
<content type='text'>
commit dfcb9f4f99f1e9a49e43398a7bfbf56927544af1 upstream.

commit 2dcab5984841 ("sctp: avoid BUG_ON on sctp_wait_for_sndbuf")
attempted to avoid a BUG_ON call when the association being used for a
sendmsg() is blocked waiting for more sndbuf and another thread did a
peeloff operation on such asoc, moving it to another socket.

As Ben Hutchings noticed, then in such case it would return without
locking back the socket and would cause two unlocks in a row.

Further analysis also revealed that it could allow a double free if the
application managed to peeloff the asoc that is created during the
sendmsg call, because then sctp_sendmsg() would try to free the asoc
that was created only for that call.

This patch takes another approach. It will deny the peeloff operation
if there is a thread sleeping on the asoc, so this situation doesn't
exist anymore. This avoids the issues described above and also honors
the syscalls that are already being handled (it can be multiple sendmsg
calls).

Joint work with Xin Long.

Fixes: 2dcab5984841 ("sctp: avoid BUG_ON on sctp_wait_for_sndbuf")
Cc: Alexander Popov &lt;alex.popov@linux.com&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
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>
commit dfcb9f4f99f1e9a49e43398a7bfbf56927544af1 upstream.

commit 2dcab5984841 ("sctp: avoid BUG_ON on sctp_wait_for_sndbuf")
attempted to avoid a BUG_ON call when the association being used for a
sendmsg() is blocked waiting for more sndbuf and another thread did a
peeloff operation on such asoc, moving it to another socket.

As Ben Hutchings noticed, then in such case it would return without
locking back the socket and would cause two unlocks in a row.

Further analysis also revealed that it could allow a double free if the
application managed to peeloff the asoc that is created during the
sendmsg call, because then sctp_sendmsg() would try to free the asoc
that was created only for that call.

This patch takes another approach. It will deny the peeloff operation
if there is a thread sleeping on the asoc, so this situation doesn't
exist anymore. This avoids the issues described above and also honors
the syscalls that are already being handled (it can be multiple sendmsg
calls).

Joint work with Xin Long.

Fixes: 2dcab5984841 ("sctp: avoid BUG_ON on sctp_wait_for_sndbuf")
Cc: Alexander Popov &lt;alex.popov@linux.com&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Signed-off-by: Xin Long &lt;lucien.xin@gmail.com&gt;
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>sctp: avoid BUG_ON on sctp_wait_for_sndbuf</title>
<updated>2017-03-16T02:18:58+00:00</updated>
<author>
<name>Marcelo Ricardo Leitner</name>
<email>marcelo.leitner@gmail.com</email>
</author>
<published>2017-02-06T20:10:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8b9f297cd4171ffaec7441b38cecd61f9c5b3a7f'/>
<id>8b9f297cd4171ffaec7441b38cecd61f9c5b3a7f</id>
<content type='text'>
commit 2dcab598484185dea7ec22219c76dcdd59e3cb90 upstream.

Alexander Popov reported that an application may trigger a BUG_ON in
sctp_wait_for_sndbuf if the socket tx buffer is full, a thread is
waiting on it to queue more data and meanwhile another thread peels off
the association being used by the first thread.

This patch replaces the BUG_ON call with a proper error handling. It
will return -EPIPE to the original sendmsg call, similarly to what would
have been done if the association wasn't found in the first place.

Acked-by: Alexander Popov &lt;alex.popov@linux.com&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Reviewed-by: Xin Long &lt;lucien.xin@gmail.com&gt;
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>
commit 2dcab598484185dea7ec22219c76dcdd59e3cb90 upstream.

Alexander Popov reported that an application may trigger a BUG_ON in
sctp_wait_for_sndbuf if the socket tx buffer is full, a thread is
waiting on it to queue more data and meanwhile another thread peels off
the association being used by the first thread.

This patch replaces the BUG_ON call with a proper error handling. It
will return -EPIPE to the original sendmsg call, similarly to what would
have been done if the association wasn't found in the first place.

Acked-by: Alexander Popov &lt;alex.popov@linux.com&gt;
Signed-off-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Reviewed-by: Xin Long &lt;lucien.xin@gmail.com&gt;
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>igmp, mld: Fix memory leak in igmpv3/mld_del_delrec()</title>
<updated>2017-03-16T02:18:58+00:00</updated>
<author>
<name>Hangbin Liu</name>
<email>liuhangbin@gmail.com</email>
</author>
<published>2017-02-08T13:16:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=688ddc50ce7300bf323ae75010ae039e796eea06'/>
<id>688ddc50ce7300bf323ae75010ae039e796eea06</id>
<content type='text'>
commit 9c8bb163ae784be4f79ae504e78c862806087c54 upstream.

In function igmpv3/mld_add_delrec() we allocate pmc and put it in
idev-&gt;mc_tomb, so we should free it when we don't need it in del_delrec().
But I removed kfree(pmc) incorrectly in latest two patches. Now fix it.

Fixes: 24803f38a5c0 ("igmp: do not remove igmp souce list info when ...")
Fixes: 1666d49e1d41 ("mld: do not remove mld souce list info when ...")
Reported-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.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 9c8bb163ae784be4f79ae504e78c862806087c54 upstream.

In function igmpv3/mld_add_delrec() we allocate pmc and put it in
idev-&gt;mc_tomb, so we should free it when we don't need it in del_delrec().
But I removed kfree(pmc) incorrectly in latest two patches. Now fix it.

Fixes: 24803f38a5c0 ("igmp: do not remove igmp souce list info when ...")
Fixes: 1666d49e1d41 ("mld: do not remove mld souce list info when ...")
Reported-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.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>mld: do not remove mld souce list info when set link down</title>
<updated>2017-03-16T02:18:58+00:00</updated>
<author>
<name>Hangbin Liu</name>
<email>liuhangbin@gmail.com</email>
</author>
<published>2017-01-12T13:19:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7c906c367c7dacf6f641e70910f11acd7195e8e9'/>
<id>7c906c367c7dacf6f641e70910f11acd7195e8e9</id>
<content type='text'>
commit 1666d49e1d416fcc2cce708242a52fe3317ea8ba upstream.

This is an IPv6 version of commit 24803f38a5c0 ("igmp: do not remove igmp
souce list..."). In mld_del_delrec(), we will restore back all source filter
info instead of flush them.

Move mld_clear_delrec() from ipv6_mc_down() to ipv6_mc_destroy_dev() since
we should not remove source list info when set link down. Remove
igmp6_group_dropped() in ipv6_mc_destroy_dev() since we have called it in
ipv6_mc_down().

Also clear all source info after igmp6_group_dropped() instead of in it
because ipv6_mc_down() will call igmp6_group_dropped().

Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Timer code moved around in ipv6_mc_down() is different
 - 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>
commit 1666d49e1d416fcc2cce708242a52fe3317ea8ba upstream.

This is an IPv6 version of commit 24803f38a5c0 ("igmp: do not remove igmp
souce list..."). In mld_del_delrec(), we will restore back all source filter
info instead of flush them.

Move mld_clear_delrec() from ipv6_mc_down() to ipv6_mc_destroy_dev() since
we should not remove source list info when set link down. Remove
igmp6_group_dropped() in ipv6_mc_destroy_dev() since we have called it in
ipv6_mc_down().

Also clear all source info after igmp6_group_dropped() instead of in it
because ipv6_mc_down() will call igmp6_group_dropped().

Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Timer code moved around in ipv6_mc_down() is different
 - Adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>igmp: do not remove igmp souce list info when set link down</title>
<updated>2017-03-16T02:18:57+00:00</updated>
<author>
<name>Hangbin Liu</name>
<email>liuhangbin@gmail.com</email>
</author>
<published>2016-11-14T08:16:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=bd1b664a19403ede448d29c87b2f23796bc7a577'/>
<id>bd1b664a19403ede448d29c87b2f23796bc7a577</id>
<content type='text'>
commit 24803f38a5c0b6c57ed800b47e695f9ce474bc3a upstream.

In commit 24cf3af3fed5 ("igmp: call ip_mc_clear_src..."), we forgot to remove
igmpv3_clear_delrec() in ip_mc_down(), which also called ip_mc_clear_src().
This make us clear all IGMPv3 source filter info after NETDEV_DOWN.
Move igmpv3_clear_delrec() to ip_mc_destroy_dev() and then no need
ip_mc_clear_src() in ip_mc_destroy_dev().

On the other hand, we should restore back instead of free all source filter
info in igmpv3_del_delrec(). Or we will not able to restore IGMPv3 source
filter info after NETDEV_UP and NETDEV_POST_TYPE_CHANGE.

Fixes: 24cf3af3fed5 ("igmp: call ip_mc_clear_src() only when ...")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Use IGMP_Unsolicited_Report_Count instead of sysctl_igmp_qrv
 - 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>
commit 24803f38a5c0b6c57ed800b47e695f9ce474bc3a upstream.

In commit 24cf3af3fed5 ("igmp: call ip_mc_clear_src..."), we forgot to remove
igmpv3_clear_delrec() in ip_mc_down(), which also called ip_mc_clear_src().
This make us clear all IGMPv3 source filter info after NETDEV_DOWN.
Move igmpv3_clear_delrec() to ip_mc_destroy_dev() and then no need
ip_mc_clear_src() in ip_mc_destroy_dev().

On the other hand, we should restore back instead of free all source filter
info in igmpv3_del_delrec(). Or we will not able to restore IGMPv3 source
filter info after NETDEV_UP and NETDEV_POST_TYPE_CHANGE.

Fixes: 24cf3af3fed5 ("igmp: call ip_mc_clear_src() only when ...")
Signed-off-by: Hangbin Liu &lt;liuhangbin@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
[bwh: Backported to 3.2:
 - Use IGMP_Unsolicited_Report_Count instead of sysctl_igmp_qrv
 - Adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tcp: fix 0 divide in __tcp_select_window()</title>
<updated>2017-03-16T02:18:57+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2017-02-01T16:33:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=35558f807792c21900e23046d97d7c6458f48c75'/>
<id>35558f807792c21900e23046d97d7c6458f48c75</id>
<content type='text'>
[ Upstream commit 06425c308b92eaf60767bc71d359f4cbc7a561f8 ]

syszkaller fuzzer was able to trigger a divide by zero, when
TCP window scaling is not enabled.

SO_RCVBUF can be used not only to increase sk_rcvbuf, also
to decrease it below current receive buffers utilization.

If mss is negative or 0, just return a zero TCP window.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Dmitry Vyukov  &lt;dvyukov@google.com&gt;
Acked-by: Neal Cardwell &lt;ncardwell@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 06425c308b92eaf60767bc71d359f4cbc7a561f8 ]

syszkaller fuzzer was able to trigger a divide by zero, when
TCP window scaling is not enabled.

SO_RCVBUF can be used not only to increase sk_rcvbuf, also
to decrease it below current receive buffers utilization.

If mss is negative or 0, just return a zero TCP window.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Dmitry Vyukov  &lt;dvyukov@google.com&gt;
Acked-by: Neal Cardwell &lt;ncardwell@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>ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()</title>
<updated>2017-03-16T02:18:56+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2017-02-01T08:46:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=27562537ad98909237e0cf1f25b049298edbb800'/>
<id>27562537ad98909237e0cf1f25b049298edbb800</id>
<content type='text'>
[ Upstream commit 63117f09c768be05a0bf465911297dc76394f686 ]

Casting is a high precedence operation but "off" and "i" are in terms of
bytes so we need to have some parenthesis here.

Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 63117f09c768be05a0bf465911297dc76394f686 ]

Casting is a high precedence operation but "off" and "i" are in terms of
bytes so we need to have some parenthesis here.

Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ipv6: fix ip6_tnl_parse_tlv_enc_lim()</title>
<updated>2017-03-16T02:18:56+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2017-01-24T00:43:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a6f6bb6bc04a5f88a31f47a6123d3fbf5ee8d694'/>
<id>a6f6bb6bc04a5f88a31f47a6123d3fbf5ee8d694</id>
<content type='text'>
[ Upstream commit fbfa743a9d2a0ffa24251764f10afc13eb21e739 ]

This function suffers from multiple issues.

First one is that pskb_may_pull() may reallocate skb-&gt;head,
so the 'raw' pointer needs either to be reloaded or not used at all.

Second issue is that NEXTHDR_DEST handling does not validate
that the options are present in skb-&gt;data, so we might read
garbage or access non existent memory.

With help from Willem de Bruijn.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Dmitry Vyukov  &lt;dvyukov@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 fbfa743a9d2a0ffa24251764f10afc13eb21e739 ]

This function suffers from multiple issues.

First one is that pskb_may_pull() may reallocate skb-&gt;head,
so the 'raw' pointer needs either to be reloaded or not used at all.

Second issue is that NEXTHDR_DEST handling does not validate
that the options are present in skb-&gt;data, so we might read
garbage or access non existent memory.

With help from Willem de Bruijn.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Dmitry Vyukov  &lt;dvyukov@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>
