<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/net/ppp, branch linux-4.5.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>ppp: take reference on channels netns</title>
<updated>2016-04-20T06:45:15+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2016-03-23T15:38:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d1d87a48fa9731247424675f6abc5daba74ec3f8'/>
<id>d1d87a48fa9731247424675f6abc5daba74ec3f8</id>
<content type='text'>
[ Upstream commit 1f461dcdd296eecedaffffc6bae2bfa90bd7eb89 ]

Let channels hold a reference on their network namespace.
Some channel types, like ppp_async and ppp_synctty, can have their
userspace controller running in a different namespace. Therefore they
can't rely on them to preclude their netns from being removed from
under them.

==================================================================
BUG: KASAN: use-after-free in ppp_unregister_channel+0x372/0x3a0 at
addr ffff880064e217e0
Read of size 8 by task syz-executor/11581
=============================================================================
BUG net_namespace (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Allocated in copy_net_ns+0x6b/0x1a0 age=92569 cpu=3 pid=6906
[&lt;      none      &gt;] ___slab_alloc+0x4c7/0x500 kernel/mm/slub.c:2440
[&lt;      none      &gt;] __slab_alloc+0x4c/0x90 kernel/mm/slub.c:2469
[&lt;     inline     &gt;] slab_alloc_node kernel/mm/slub.c:2532
[&lt;     inline     &gt;] slab_alloc kernel/mm/slub.c:2574
[&lt;      none      &gt;] kmem_cache_alloc+0x23a/0x2b0 kernel/mm/slub.c:2579
[&lt;     inline     &gt;] kmem_cache_zalloc kernel/include/linux/slab.h:597
[&lt;     inline     &gt;] net_alloc kernel/net/core/net_namespace.c:325
[&lt;      none      &gt;] copy_net_ns+0x6b/0x1a0 kernel/net/core/net_namespace.c:360
[&lt;      none      &gt;] create_new_namespaces+0x2f6/0x610 kernel/kernel/nsproxy.c:95
[&lt;      none      &gt;] copy_namespaces+0x297/0x320 kernel/kernel/nsproxy.c:150
[&lt;      none      &gt;] copy_process.part.35+0x1bf4/0x5760 kernel/kernel/fork.c:1451
[&lt;     inline     &gt;] copy_process kernel/kernel/fork.c:1274
[&lt;      none      &gt;] _do_fork+0x1bc/0xcb0 kernel/kernel/fork.c:1723
[&lt;     inline     &gt;] SYSC_clone kernel/kernel/fork.c:1832
[&lt;      none      &gt;] SyS_clone+0x37/0x50 kernel/kernel/fork.c:1826
[&lt;      none      &gt;] entry_SYSCALL_64_fastpath+0x16/0x7a kernel/arch/x86/entry/entry_64.S:185

INFO: Freed in net_drop_ns+0x67/0x80 age=575 cpu=2 pid=2631
[&lt;      none      &gt;] __slab_free+0x1fc/0x320 kernel/mm/slub.c:2650
[&lt;     inline     &gt;] slab_free kernel/mm/slub.c:2805
[&lt;      none      &gt;] kmem_cache_free+0x2a0/0x330 kernel/mm/slub.c:2814
[&lt;     inline     &gt;] net_free kernel/net/core/net_namespace.c:341
[&lt;      none      &gt;] net_drop_ns+0x67/0x80 kernel/net/core/net_namespace.c:348
[&lt;      none      &gt;] cleanup_net+0x4e5/0x600 kernel/net/core/net_namespace.c:448
[&lt;      none      &gt;] process_one_work+0x794/0x1440 kernel/kernel/workqueue.c:2036
[&lt;      none      &gt;] worker_thread+0xdb/0xfc0 kernel/kernel/workqueue.c:2170
[&lt;      none      &gt;] kthread+0x23f/0x2d0 kernel/drivers/block/aoe/aoecmd.c:1303
[&lt;      none      &gt;] ret_from_fork+0x3f/0x70 kernel/arch/x86/entry/entry_64.S:468
INFO: Slab 0xffffea0001938800 objects=3 used=0 fp=0xffff880064e20000
flags=0x5fffc0000004080
INFO: Object 0xffff880064e20000 @offset=0 fp=0xffff880064e24200

CPU: 1 PID: 11581 Comm: syz-executor Tainted: G    B           4.4.0+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 00000000ffffffff ffff8800662c7790 ffffffff8292049d ffff88003e36a300
 ffff880064e20000 ffff880064e20000 ffff8800662c77c0 ffffffff816f2054
 ffff88003e36a300 ffffea0001938800 ffff880064e20000 0000000000000000
Call Trace:
 [&lt;     inline     &gt;] __dump_stack kernel/lib/dump_stack.c:15
 [&lt;ffffffff8292049d&gt;] dump_stack+0x6f/0xa2 kernel/lib/dump_stack.c:50
 [&lt;ffffffff816f2054&gt;] print_trailer+0xf4/0x150 kernel/mm/slub.c:654
 [&lt;ffffffff816f875f&gt;] object_err+0x2f/0x40 kernel/mm/slub.c:661
 [&lt;     inline     &gt;] print_address_description kernel/mm/kasan/report.c:138
 [&lt;ffffffff816fb0c5&gt;] kasan_report_error+0x215/0x530 kernel/mm/kasan/report.c:236
 [&lt;     inline     &gt;] kasan_report kernel/mm/kasan/report.c:259
 [&lt;ffffffff816fb4de&gt;] __asan_report_load8_noabort+0x3e/0x40 kernel/mm/kasan/report.c:280
 [&lt;     inline     &gt;] ? ppp_pernet kernel/include/linux/compiler.h:218
 [&lt;ffffffff83ad71b2&gt;] ? ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [&lt;     inline     &gt;] ppp_pernet kernel/include/linux/compiler.h:218
 [&lt;ffffffff83ad71b2&gt;] ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [&lt;     inline     &gt;] ? ppp_pernet kernel/drivers/net/ppp/ppp_generic.c:293
 [&lt;ffffffff83ad6f26&gt;] ? ppp_unregister_channel+0xe6/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [&lt;ffffffff83ae18f3&gt;] ppp_asynctty_close+0xa3/0x130 kernel/drivers/net/ppp/ppp_async.c:241
 [&lt;ffffffff83ae1850&gt;] ? async_lcp_peek+0x5b0/0x5b0 kernel/drivers/net/ppp/ppp_async.c:1000
 [&lt;ffffffff82c33239&gt;] tty_ldisc_close.isra.1+0x99/0xe0 kernel/drivers/tty/tty_ldisc.c:478
 [&lt;ffffffff82c332c0&gt;] tty_ldisc_kill+0x40/0x170 kernel/drivers/tty/tty_ldisc.c:744
 [&lt;ffffffff82c34943&gt;] tty_ldisc_release+0x1b3/0x260 kernel/drivers/tty/tty_ldisc.c:772
 [&lt;ffffffff82c1ef21&gt;] tty_release+0xac1/0x13e0 kernel/drivers/tty/tty_io.c:1901
 [&lt;ffffffff82c1e460&gt;] ? release_tty+0x320/0x320 kernel/drivers/tty/tty_io.c:1688
 [&lt;ffffffff8174de36&gt;] __fput+0x236/0x780 kernel/fs/file_table.c:208
 [&lt;ffffffff8174e405&gt;] ____fput+0x15/0x20 kernel/fs/file_table.c:244
 [&lt;ffffffff813595ab&gt;] task_work_run+0x16b/0x200 kernel/kernel/task_work.c:115
 [&lt;     inline     &gt;] exit_task_work kernel/include/linux/task_work.h:21
 [&lt;ffffffff81307105&gt;] do_exit+0x8b5/0x2c60 kernel/kernel/exit.c:750
 [&lt;ffffffff813fdd20&gt;] ? debug_check_no_locks_freed+0x290/0x290 kernel/kernel/locking/lockdep.c:4123
 [&lt;ffffffff81306850&gt;] ? mm_update_next_owner+0x6f0/0x6f0 kernel/kernel/exit.c:357
 [&lt;ffffffff813215e6&gt;] ? __dequeue_signal+0x136/0x470 kernel/kernel/signal.c:550
 [&lt;ffffffff8132067b&gt;] ? recalc_sigpending_tsk+0x13b/0x180 kernel/kernel/signal.c:145
 [&lt;ffffffff81309628&gt;] do_group_exit+0x108/0x330 kernel/kernel/exit.c:880
 [&lt;ffffffff8132b9d4&gt;] get_signal+0x5e4/0x14f0 kernel/kernel/signal.c:2307
 [&lt;     inline     &gt;] ? kretprobe_table_lock kernel/kernel/kprobes.c:1113
 [&lt;ffffffff8151d355&gt;] ? kprobe_flush_task+0xb5/0x450 kernel/kernel/kprobes.c:1158
 [&lt;ffffffff8115f7d3&gt;] do_signal+0x83/0x1c90 kernel/arch/x86/kernel/signal.c:712
 [&lt;ffffffff8151d2a0&gt;] ? recycle_rp_inst+0x310/0x310 kernel/include/linux/list.h:655
 [&lt;ffffffff8115f750&gt;] ? setup_sigcontext+0x780/0x780 kernel/arch/x86/kernel/signal.c:165
 [&lt;ffffffff81380864&gt;] ? finish_task_switch+0x424/0x5f0 kernel/kernel/sched/core.c:2692
 [&lt;     inline     &gt;] ? finish_lock_switch kernel/kernel/sched/sched.h:1099
 [&lt;ffffffff81380560&gt;] ? finish_task_switch+0x120/0x5f0 kernel/kernel/sched/core.c:2678
 [&lt;     inline     &gt;] ? context_switch kernel/kernel/sched/core.c:2807
 [&lt;ffffffff85d794e9&gt;] ? __schedule+0x919/0x1bd0 kernel/kernel/sched/core.c:3283
 [&lt;ffffffff81003901&gt;] exit_to_usermode_loop+0xf1/0x1a0 kernel/arch/x86/entry/common.c:247
 [&lt;     inline     &gt;] prepare_exit_to_usermode kernel/arch/x86/entry/common.c:282
 [&lt;ffffffff810062ef&gt;] syscall_return_slowpath+0x19f/0x210 kernel/arch/x86/entry/common.c:344
 [&lt;ffffffff85d88022&gt;] int_ret_from_sys_call+0x25/0x9f kernel/arch/x86/entry/entry_64.S:281
Memory state around the buggy address:
 ffff880064e21680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
&gt;ffff880064e21780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff880064e21800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
Reported-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Reviewed-by: Cyrill Gorcunov &lt;gorcunov@openvz.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 1f461dcdd296eecedaffffc6bae2bfa90bd7eb89 ]

Let channels hold a reference on their network namespace.
Some channel types, like ppp_async and ppp_synctty, can have their
userspace controller running in a different namespace. Therefore they
can't rely on them to preclude their netns from being removed from
under them.

==================================================================
BUG: KASAN: use-after-free in ppp_unregister_channel+0x372/0x3a0 at
addr ffff880064e217e0
Read of size 8 by task syz-executor/11581
=============================================================================
BUG net_namespace (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Allocated in copy_net_ns+0x6b/0x1a0 age=92569 cpu=3 pid=6906
[&lt;      none      &gt;] ___slab_alloc+0x4c7/0x500 kernel/mm/slub.c:2440
[&lt;      none      &gt;] __slab_alloc+0x4c/0x90 kernel/mm/slub.c:2469
[&lt;     inline     &gt;] slab_alloc_node kernel/mm/slub.c:2532
[&lt;     inline     &gt;] slab_alloc kernel/mm/slub.c:2574
[&lt;      none      &gt;] kmem_cache_alloc+0x23a/0x2b0 kernel/mm/slub.c:2579
[&lt;     inline     &gt;] kmem_cache_zalloc kernel/include/linux/slab.h:597
[&lt;     inline     &gt;] net_alloc kernel/net/core/net_namespace.c:325
[&lt;      none      &gt;] copy_net_ns+0x6b/0x1a0 kernel/net/core/net_namespace.c:360
[&lt;      none      &gt;] create_new_namespaces+0x2f6/0x610 kernel/kernel/nsproxy.c:95
[&lt;      none      &gt;] copy_namespaces+0x297/0x320 kernel/kernel/nsproxy.c:150
[&lt;      none      &gt;] copy_process.part.35+0x1bf4/0x5760 kernel/kernel/fork.c:1451
[&lt;     inline     &gt;] copy_process kernel/kernel/fork.c:1274
[&lt;      none      &gt;] _do_fork+0x1bc/0xcb0 kernel/kernel/fork.c:1723
[&lt;     inline     &gt;] SYSC_clone kernel/kernel/fork.c:1832
[&lt;      none      &gt;] SyS_clone+0x37/0x50 kernel/kernel/fork.c:1826
[&lt;      none      &gt;] entry_SYSCALL_64_fastpath+0x16/0x7a kernel/arch/x86/entry/entry_64.S:185

INFO: Freed in net_drop_ns+0x67/0x80 age=575 cpu=2 pid=2631
[&lt;      none      &gt;] __slab_free+0x1fc/0x320 kernel/mm/slub.c:2650
[&lt;     inline     &gt;] slab_free kernel/mm/slub.c:2805
[&lt;      none      &gt;] kmem_cache_free+0x2a0/0x330 kernel/mm/slub.c:2814
[&lt;     inline     &gt;] net_free kernel/net/core/net_namespace.c:341
[&lt;      none      &gt;] net_drop_ns+0x67/0x80 kernel/net/core/net_namespace.c:348
[&lt;      none      &gt;] cleanup_net+0x4e5/0x600 kernel/net/core/net_namespace.c:448
[&lt;      none      &gt;] process_one_work+0x794/0x1440 kernel/kernel/workqueue.c:2036
[&lt;      none      &gt;] worker_thread+0xdb/0xfc0 kernel/kernel/workqueue.c:2170
[&lt;      none      &gt;] kthread+0x23f/0x2d0 kernel/drivers/block/aoe/aoecmd.c:1303
[&lt;      none      &gt;] ret_from_fork+0x3f/0x70 kernel/arch/x86/entry/entry_64.S:468
INFO: Slab 0xffffea0001938800 objects=3 used=0 fp=0xffff880064e20000
flags=0x5fffc0000004080
INFO: Object 0xffff880064e20000 @offset=0 fp=0xffff880064e24200

CPU: 1 PID: 11581 Comm: syz-executor Tainted: G    B           4.4.0+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 00000000ffffffff ffff8800662c7790 ffffffff8292049d ffff88003e36a300
 ffff880064e20000 ffff880064e20000 ffff8800662c77c0 ffffffff816f2054
 ffff88003e36a300 ffffea0001938800 ffff880064e20000 0000000000000000
Call Trace:
 [&lt;     inline     &gt;] __dump_stack kernel/lib/dump_stack.c:15
 [&lt;ffffffff8292049d&gt;] dump_stack+0x6f/0xa2 kernel/lib/dump_stack.c:50
 [&lt;ffffffff816f2054&gt;] print_trailer+0xf4/0x150 kernel/mm/slub.c:654
 [&lt;ffffffff816f875f&gt;] object_err+0x2f/0x40 kernel/mm/slub.c:661
 [&lt;     inline     &gt;] print_address_description kernel/mm/kasan/report.c:138
 [&lt;ffffffff816fb0c5&gt;] kasan_report_error+0x215/0x530 kernel/mm/kasan/report.c:236
 [&lt;     inline     &gt;] kasan_report kernel/mm/kasan/report.c:259
 [&lt;ffffffff816fb4de&gt;] __asan_report_load8_noabort+0x3e/0x40 kernel/mm/kasan/report.c:280
 [&lt;     inline     &gt;] ? ppp_pernet kernel/include/linux/compiler.h:218
 [&lt;ffffffff83ad71b2&gt;] ? ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [&lt;     inline     &gt;] ppp_pernet kernel/include/linux/compiler.h:218
 [&lt;ffffffff83ad71b2&gt;] ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [&lt;     inline     &gt;] ? ppp_pernet kernel/drivers/net/ppp/ppp_generic.c:293
 [&lt;ffffffff83ad6f26&gt;] ? ppp_unregister_channel+0xe6/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [&lt;ffffffff83ae18f3&gt;] ppp_asynctty_close+0xa3/0x130 kernel/drivers/net/ppp/ppp_async.c:241
 [&lt;ffffffff83ae1850&gt;] ? async_lcp_peek+0x5b0/0x5b0 kernel/drivers/net/ppp/ppp_async.c:1000
 [&lt;ffffffff82c33239&gt;] tty_ldisc_close.isra.1+0x99/0xe0 kernel/drivers/tty/tty_ldisc.c:478
 [&lt;ffffffff82c332c0&gt;] tty_ldisc_kill+0x40/0x170 kernel/drivers/tty/tty_ldisc.c:744
 [&lt;ffffffff82c34943&gt;] tty_ldisc_release+0x1b3/0x260 kernel/drivers/tty/tty_ldisc.c:772
 [&lt;ffffffff82c1ef21&gt;] tty_release+0xac1/0x13e0 kernel/drivers/tty/tty_io.c:1901
 [&lt;ffffffff82c1e460&gt;] ? release_tty+0x320/0x320 kernel/drivers/tty/tty_io.c:1688
 [&lt;ffffffff8174de36&gt;] __fput+0x236/0x780 kernel/fs/file_table.c:208
 [&lt;ffffffff8174e405&gt;] ____fput+0x15/0x20 kernel/fs/file_table.c:244
 [&lt;ffffffff813595ab&gt;] task_work_run+0x16b/0x200 kernel/kernel/task_work.c:115
 [&lt;     inline     &gt;] exit_task_work kernel/include/linux/task_work.h:21
 [&lt;ffffffff81307105&gt;] do_exit+0x8b5/0x2c60 kernel/kernel/exit.c:750
 [&lt;ffffffff813fdd20&gt;] ? debug_check_no_locks_freed+0x290/0x290 kernel/kernel/locking/lockdep.c:4123
 [&lt;ffffffff81306850&gt;] ? mm_update_next_owner+0x6f0/0x6f0 kernel/kernel/exit.c:357
 [&lt;ffffffff813215e6&gt;] ? __dequeue_signal+0x136/0x470 kernel/kernel/signal.c:550
 [&lt;ffffffff8132067b&gt;] ? recalc_sigpending_tsk+0x13b/0x180 kernel/kernel/signal.c:145
 [&lt;ffffffff81309628&gt;] do_group_exit+0x108/0x330 kernel/kernel/exit.c:880
 [&lt;ffffffff8132b9d4&gt;] get_signal+0x5e4/0x14f0 kernel/kernel/signal.c:2307
 [&lt;     inline     &gt;] ? kretprobe_table_lock kernel/kernel/kprobes.c:1113
 [&lt;ffffffff8151d355&gt;] ? kprobe_flush_task+0xb5/0x450 kernel/kernel/kprobes.c:1158
 [&lt;ffffffff8115f7d3&gt;] do_signal+0x83/0x1c90 kernel/arch/x86/kernel/signal.c:712
 [&lt;ffffffff8151d2a0&gt;] ? recycle_rp_inst+0x310/0x310 kernel/include/linux/list.h:655
 [&lt;ffffffff8115f750&gt;] ? setup_sigcontext+0x780/0x780 kernel/arch/x86/kernel/signal.c:165
 [&lt;ffffffff81380864&gt;] ? finish_task_switch+0x424/0x5f0 kernel/kernel/sched/core.c:2692
 [&lt;     inline     &gt;] ? finish_lock_switch kernel/kernel/sched/sched.h:1099
 [&lt;ffffffff81380560&gt;] ? finish_task_switch+0x120/0x5f0 kernel/kernel/sched/core.c:2678
 [&lt;     inline     &gt;] ? context_switch kernel/kernel/sched/core.c:2807
 [&lt;ffffffff85d794e9&gt;] ? __schedule+0x919/0x1bd0 kernel/kernel/sched/core.c:3283
 [&lt;ffffffff81003901&gt;] exit_to_usermode_loop+0xf1/0x1a0 kernel/arch/x86/entry/common.c:247
 [&lt;     inline     &gt;] prepare_exit_to_usermode kernel/arch/x86/entry/common.c:282
 [&lt;ffffffff810062ef&gt;] syscall_return_slowpath+0x19f/0x210 kernel/arch/x86/entry/common.c:344
 [&lt;ffffffff85d88022&gt;] int_ret_from_sys_call+0x25/0x9f kernel/arch/x86/entry/entry_64.S:281
Memory state around the buggy address:
 ffff880064e21680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
&gt;ffff880064e21780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff880064e21800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
Reported-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Reviewed-by: Cyrill Gorcunov &lt;gorcunov@openvz.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>ppp: ensure file-&gt;private_data can't be overridden</title>
<updated>2016-04-20T06:45:14+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2016-03-14T20:17:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=85bd3c9ed95df9535f02510005daf839c9ee1323'/>
<id>85bd3c9ed95df9535f02510005daf839c9ee1323</id>
<content type='text'>
[ Upstream commit e8e56ffd9d2973398b60ece1f1bebb8d67b4d032 ]

Locking ppp_mutex must be done before dereferencing file-&gt;private_data,
otherwise it could be modified before ppp_unattached_ioctl() takes the
lock. This could lead ppp_unattached_ioctl() to override -&gt;private_data,
thus leaking reference to the ppp_file previously pointed to.

v2: lock all ppp_ioctl() instead of just checking private_data in
    ppp_unattached_ioctl(), to avoid ambiguous behaviour.

Fixes: f3ff8a4d80e8 ("ppp: push BKL down into the driver")
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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 e8e56ffd9d2973398b60ece1f1bebb8d67b4d032 ]

Locking ppp_mutex must be done before dereferencing file-&gt;private_data,
otherwise it could be modified before ppp_unattached_ioctl() takes the
lock. This could lead ppp_unattached_ioctl() to override -&gt;private_data,
thus leaking reference to the ppp_file previously pointed to.

v2: lock all ppp_ioctl() instead of just checking private_data in
    ppp_unattached_ioctl(), to avoid ambiguous behaviour.

Fixes: f3ff8a4d80e8 ("ppp: push BKL down into the driver")
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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>ppp: release rtnl mutex when interface creation fails</title>
<updated>2016-03-07T21:11:31+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2016-03-07T18:36:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6faac63a6986f29ef39827f460edd3a5ba64ad5c'/>
<id>6faac63a6986f29ef39827f460edd3a5ba64ad5c</id>
<content type='text'>
Add missing rtnl_unlock() in the error path of ppp_create_interface().

Fixes: 58a89ecaca53 ("ppp: fix lockdep splat in ppp_dev_uninit()")
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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>
Add missing rtnl_unlock() in the error path of ppp_create_interface().

Fixes: 58a89ecaca53 ("ppp: fix lockdep splat in ppp_dev_uninit()")
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ppp: lock ppp-&gt;flags in ppp_read() and ppp_poll()</title>
<updated>2016-03-01T21:15:07+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2016-02-26T17:45:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=edffc2178d4ba10a61e150b42ef5e7d797714eb3'/>
<id>edffc2178d4ba10a61e150b42ef5e7d797714eb3</id>
<content type='text'>
ppp_read() and ppp_poll() can be called concurrently with ppp_ioctl().
In this case, ppp_ioctl() might call ppp_ccp_closed(), which may update
ppp-&gt;flags while ppp_read() or ppp_poll() is reading it.
The update done by ppp_ccp_closed() isn't atomic due to the bit mask
operation ('ppp-&gt;flags &amp;= ~(SC_CCP_OPEN | SC_CCP_UP)'), so concurrent
readers might get transient values.
Reading incorrect ppp-&gt;flags may disturb the 'ppp-&gt;flags &amp; SC_LOOP_TRAFFIC'
test in ppp_read() and ppp_poll(), which in turn can lead to improper
decision on whether the PPP unit file is ready for reading or not.

Since ppp_ccp_closed() is protected by the Rx and Tx locks (with
ppp_lock()), taking the Rx lock is enough for ppp_read() and ppp_poll()
to guarantee that ppp_ccp_closed() won't update ppp-&gt;flags
concurrently.

The same reasoning applies to ppp-&gt;n_channels. The 'n_channels' field
can also be written to concurrently by ppp_ioctl() (through
ppp_connect_channel() or ppp_disconnect_channel()). These writes aren't
atomic (simple increment/decrement), but are protected by both the Rx
and Tx locks (like in the ppp-&gt;flags case). So holding the Rx lock
before reading ppp-&gt;n_channels also prevents concurrent writes.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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>
ppp_read() and ppp_poll() can be called concurrently with ppp_ioctl().
In this case, ppp_ioctl() might call ppp_ccp_closed(), which may update
ppp-&gt;flags while ppp_read() or ppp_poll() is reading it.
The update done by ppp_ccp_closed() isn't atomic due to the bit mask
operation ('ppp-&gt;flags &amp;= ~(SC_CCP_OPEN | SC_CCP_UP)'), so concurrent
readers might get transient values.
Reading incorrect ppp-&gt;flags may disturb the 'ppp-&gt;flags &amp; SC_LOOP_TRAFFIC'
test in ppp_read() and ppp_poll(), which in turn can lead to improper
decision on whether the PPP unit file is ready for reading or not.

Since ppp_ccp_closed() is protected by the Rx and Tx locks (with
ppp_lock()), taking the Rx lock is enough for ppp_read() and ppp_poll()
to guarantee that ppp_ccp_closed() won't update ppp-&gt;flags
concurrently.

The same reasoning applies to ppp-&gt;n_channels. The 'n_channels' field
can also be written to concurrently by ppp_ioctl() (through
ppp_connect_channel() or ppp_disconnect_channel()). These writes aren't
atomic (simple increment/decrement), but are protected by both the Rx
and Tx locks (like in the ppp-&gt;flags case). So holding the Rx lock
before reading ppp-&gt;n_channels also prevents concurrent writes.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pppoe: fix reference counting in PPPoE proxy</title>
<updated>2016-02-17T21:02:01+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2016-02-15T16:01:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=29e73269aa4d36f92b35610c25f8b01c789b0dc8'/>
<id>29e73269aa4d36f92b35610c25f8b01c789b0dc8</id>
<content type='text'>
Drop reference on the relay_po socket when __pppoe_xmit() succeeds.
This is already handled correctly in the error path.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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>
Drop reference on the relay_po socket when __pppoe_xmit() succeeds.
This is already handled correctly in the error path.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pptp: fix illegal memory access caused by multiple bind()s</title>
<updated>2016-01-25T06:18:26+00:00</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2016-01-22T00:39:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9a368aff9cb370298fa02feeffa861f2db497c18'/>
<id>9a368aff9cb370298fa02feeffa861f2db497c18</id>
<content type='text'>
Several times already this has been reported as kasan reports caused by
syzkaller and trinity and people always looked at RCU races, but it is
much more simple. :)

In case we bind a pptp socket multiple times, we simply add it to
the callid_sock list but don't remove the old binding. Thus the old
socket stays in the bucket with unused call_id indexes and doesn't get
cleaned up. This causes various forms of kasan reports which were hard
to pinpoint.

Simply don't allow multiple binds and correct error handling in
pptp_bind. Also keep sk_state bits in place in pptp_connect.

Fixes: 00959ade36acad ("PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)")
Cc: Dmitry Kozlov &lt;xeb@mail.ru&gt;
Cc: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Reported-by: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Signed-off-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>
Several times already this has been reported as kasan reports caused by
syzkaller and trinity and people always looked at RCU races, but it is
much more simple. :)

In case we bind a pptp socket multiple times, we simply add it to
the callid_sock list but don't remove the old binding. Thus the old
socket stays in the bucket with unused call_id indexes and doesn't get
cleaned up. This causes various forms of kasan reports which were hard
to pinpoint.

Simply don't allow multiple binds and correct error handling in
pptp_bind. Also keep sk_state bits in place in pptp_connect.

Fixes: 00959ade36acad ("PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)")
Cc: Dmitry Kozlov &lt;xeb@mail.ru&gt;
Cc: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Reported-by: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Signed-off-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>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2015-12-18T03:08:28+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-12-18T03:08:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b3e0d3d7bab14f2544a3314bec53a23dc7dd2206'/>
<id>b3e0d3d7bab14f2544a3314bec53a23dc7dd2206</id>
<content type='text'>
Conflicts:
	drivers/net/geneve.c

Here we had an overlapping change, where in 'net' the extraneous stats
bump was being removed whilst in 'net-next' the final argument to
udp_tunnel6_xmit_skb() was being changed.

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:
	drivers/net/geneve.c

Here we had an overlapping change, where in 'net' the extraneous stats
bump was being removed whilst in 'net-next' the final argument to
udp_tunnel6_xmit_skb() was being changed.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pptp: verify sockaddr_len in pptp_bind() and pptp_connect()</title>
<updated>2015-12-15T05:29:34+00:00</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2015-12-14T21:48:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=09ccfd238e5a0e670d8178cf50180ea81ae09ae1'/>
<id>09ccfd238e5a0e670d8178cf50180ea81ae09ae1</id>
<content type='text'>
Reported-by: Dmitry Vyukov &lt;dvyukov@gmail.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.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>
Reported-by: Dmitry Vyukov &lt;dvyukov@gmail.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ppp: declare ppp devices as enumerated interfaces</title>
<updated>2015-12-14T21:20:57+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2015-12-11T18:54:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=69d9728d00c7f2acc290d08718c185f231b8fc20'/>
<id>69d9728d00c7f2acc290d08718c185f231b8fc20</id>
<content type='text'>
Let user space be aware of the naming scheme used by ppp interfaces
(visible in /sys/class/net/&lt;iface&gt;/name_assign_type).

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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>
Let user space be aware of the naming scheme used by ppp interfaces
(visible in /sys/class/net/&lt;iface&gt;/name_assign_type).

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ppp: define "ppp" device type</title>
<updated>2015-12-14T21:20:57+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2015-12-11T18:54:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=94dbffe16eb187a7e9c34f1f614925fd9460ec33'/>
<id>94dbffe16eb187a7e9c34f1f614925fd9460ec33</id>
<content type='text'>
Let PPP devices be identified as such in /sys/class/net/&lt;iface&gt;/uevent.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&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>
Let PPP devices be identified as such in /sys/class/net/&lt;iface&gt;/uevent.

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