<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/sound/core/timer.c, branch v4.4.40</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>ALSA: timer: fix NULL pointer dereference on memory allocation failure</title>
<updated>2016-09-15T06:27:54+00:00</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@oracle.com</email>
</author>
<published>2016-08-28T22:33:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f5b004e4edb87ea4c0a72a72191f33d372d08251'/>
<id>f5b004e4edb87ea4c0a72a72191f33d372d08251</id>
<content type='text'>
commit 8ddc05638ee42b18ba4fe99b5fb647fa3ad20456 upstream.

I hit this with syzkaller:

    kasan: CONFIG_KASAN_INLINE enabled
    kasan: GPF could be caused by NULL-ptr deref or user memory access
    general protection fault: 0000 [#1] PREEMPT SMP KASAN
    CPU: 0 PID: 1327 Comm: a.out Not tainted 4.8.0-rc2+ #190
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    task: ffff88011278d600 task.stack: ffff8801120c0000
    RIP: 0010:[&lt;ffffffff82c8ba07&gt;]  [&lt;ffffffff82c8ba07&gt;] snd_hrtimer_start+0x77/0x100
    RSP: 0018:ffff8801120c7a60  EFLAGS: 00010006
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000007
    RDX: 0000000000000009 RSI: 1ffff10023483091 RDI: 0000000000000048
    RBP: ffff8801120c7a78 R08: ffff88011a5cf768 R09: ffff88011a5ba790
    R10: 0000000000000002 R11: ffffed00234b9ef1 R12: ffff880114843980
    R13: ffffffff84213c00 R14: ffff880114843ab0 R15: 0000000000000286
    FS:  00007f72958f3700(0000) GS:ffff88011aa00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000603001 CR3: 00000001126ab000 CR4: 00000000000006f0
    Stack:
     ffff880114843980 ffff880111eb2dc0 ffff880114843a34 ffff8801120c7ad0
     ffffffff82c81ab1 0000000000000000 ffffffff842138e0 0000000100000000
     ffff880111eb2dd0 ffff880111eb2dc0 0000000000000001 ffff880111eb2dc0
    Call Trace:
     [&lt;ffffffff82c81ab1&gt;] snd_timer_start1+0x331/0x670
     [&lt;ffffffff82c85bfd&gt;] snd_timer_start+0x5d/0xa0
     [&lt;ffffffff82c8795e&gt;] snd_timer_user_ioctl+0x88e/0x2830
     [&lt;ffffffff8159f3a0&gt;] ? __follow_pte.isra.49+0x430/0x430
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff815a26fa&gt;] ? do_wp_page+0x3aa/0x1c90
     [&lt;ffffffff8132762f&gt;] ? put_prev_entity+0x108f/0x21a0
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff816b0733&gt;] do_vfs_ioctl+0x193/0x1050
     [&lt;ffffffff813510af&gt;] ? cpuacct_account_field+0x12f/0x1a0
     [&lt;ffffffff816b05a0&gt;] ? ioctl_preallocate+0x200/0x200
     [&lt;ffffffff81002f2f&gt;] ? syscall_trace_enter+0x3cf/0xdb0
     [&lt;ffffffff815045ba&gt;] ? __context_tracking_exit.part.4+0x9a/0x1e0
     [&lt;ffffffff81002b60&gt;] ? exit_to_usermode_loop+0x190/0x190
     [&lt;ffffffff82001a97&gt;] ? check_preemption_disabled+0x37/0x1e0
     [&lt;ffffffff81d93889&gt;] ? security_file_ioctl+0x89/0xb0
     [&lt;ffffffff816b167f&gt;] SyS_ioctl+0x8f/0xc0
     [&lt;ffffffff816b15f0&gt;] ? do_vfs_ioctl+0x1050/0x1050
     [&lt;ffffffff81005524&gt;] do_syscall_64+0x1c4/0x4e0
     [&lt;ffffffff83c32b2a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    Code: c7 c7 c4 b9 c8 82 48 89 d9 4c 89 ee e8 63 88 7f fe e8 7e 46 7b fe 48 8d 7b 48 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 &lt;0f&gt; b6 04 02 84 c0 74 04 84 c0 7e 65 80 7b 48 00 74 0e e8 52 46
    RIP  [&lt;ffffffff82c8ba07&gt;] snd_hrtimer_start+0x77/0x100
     RSP &lt;ffff8801120c7a60&gt;
    ---[ end trace 5955b08db7f2b029 ]---

This can happen if snd_hrtimer_open() fails to allocate memory and
returns an error, which is currently not checked by snd_timer_open():

    ioctl(SNDRV_TIMER_IOCTL_SELECT)
     - snd_timer_user_tselect()
	- snd_timer_close()
	   - snd_hrtimer_close()
	      - (struct snd_timer *) t-&gt;private_data = NULL
        - snd_timer_open()
           - snd_hrtimer_open()
              - kzalloc() fails; t-&gt;private_data is still NULL

    ioctl(SNDRV_TIMER_IOCTL_START)
     - snd_timer_user_start()
	- snd_timer_start()
	   - snd_timer_start1()
	      - snd_hrtimer_start()
		- t-&gt;private_data == NULL // boom

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 8ddc05638ee42b18ba4fe99b5fb647fa3ad20456 upstream.

I hit this with syzkaller:

    kasan: CONFIG_KASAN_INLINE enabled
    kasan: GPF could be caused by NULL-ptr deref or user memory access
    general protection fault: 0000 [#1] PREEMPT SMP KASAN
    CPU: 0 PID: 1327 Comm: a.out Not tainted 4.8.0-rc2+ #190
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    task: ffff88011278d600 task.stack: ffff8801120c0000
    RIP: 0010:[&lt;ffffffff82c8ba07&gt;]  [&lt;ffffffff82c8ba07&gt;] snd_hrtimer_start+0x77/0x100
    RSP: 0018:ffff8801120c7a60  EFLAGS: 00010006
    RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000007
    RDX: 0000000000000009 RSI: 1ffff10023483091 RDI: 0000000000000048
    RBP: ffff8801120c7a78 R08: ffff88011a5cf768 R09: ffff88011a5ba790
    R10: 0000000000000002 R11: ffffed00234b9ef1 R12: ffff880114843980
    R13: ffffffff84213c00 R14: ffff880114843ab0 R15: 0000000000000286
    FS:  00007f72958f3700(0000) GS:ffff88011aa00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000603001 CR3: 00000001126ab000 CR4: 00000000000006f0
    Stack:
     ffff880114843980 ffff880111eb2dc0 ffff880114843a34 ffff8801120c7ad0
     ffffffff82c81ab1 0000000000000000 ffffffff842138e0 0000000100000000
     ffff880111eb2dd0 ffff880111eb2dc0 0000000000000001 ffff880111eb2dc0
    Call Trace:
     [&lt;ffffffff82c81ab1&gt;] snd_timer_start1+0x331/0x670
     [&lt;ffffffff82c85bfd&gt;] snd_timer_start+0x5d/0xa0
     [&lt;ffffffff82c8795e&gt;] snd_timer_user_ioctl+0x88e/0x2830
     [&lt;ffffffff8159f3a0&gt;] ? __follow_pte.isra.49+0x430/0x430
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff815a26fa&gt;] ? do_wp_page+0x3aa/0x1c90
     [&lt;ffffffff8132762f&gt;] ? put_prev_entity+0x108f/0x21a0
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff816b0733&gt;] do_vfs_ioctl+0x193/0x1050
     [&lt;ffffffff813510af&gt;] ? cpuacct_account_field+0x12f/0x1a0
     [&lt;ffffffff816b05a0&gt;] ? ioctl_preallocate+0x200/0x200
     [&lt;ffffffff81002f2f&gt;] ? syscall_trace_enter+0x3cf/0xdb0
     [&lt;ffffffff815045ba&gt;] ? __context_tracking_exit.part.4+0x9a/0x1e0
     [&lt;ffffffff81002b60&gt;] ? exit_to_usermode_loop+0x190/0x190
     [&lt;ffffffff82001a97&gt;] ? check_preemption_disabled+0x37/0x1e0
     [&lt;ffffffff81d93889&gt;] ? security_file_ioctl+0x89/0xb0
     [&lt;ffffffff816b167f&gt;] SyS_ioctl+0x8f/0xc0
     [&lt;ffffffff816b15f0&gt;] ? do_vfs_ioctl+0x1050/0x1050
     [&lt;ffffffff81005524&gt;] do_syscall_64+0x1c4/0x4e0
     [&lt;ffffffff83c32b2a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    Code: c7 c7 c4 b9 c8 82 48 89 d9 4c 89 ee e8 63 88 7f fe e8 7e 46 7b fe 48 8d 7b 48 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 &lt;0f&gt; b6 04 02 84 c0 74 04 84 c0 7e 65 80 7b 48 00 74 0e e8 52 46
    RIP  [&lt;ffffffff82c8ba07&gt;] snd_hrtimer_start+0x77/0x100
     RSP &lt;ffff8801120c7a60&gt;
    ---[ end trace 5955b08db7f2b029 ]---

This can happen if snd_hrtimer_open() fails to allocate memory and
returns an error, which is currently not checked by snd_timer_open():

    ioctl(SNDRV_TIMER_IOCTL_SELECT)
     - snd_timer_user_tselect()
	- snd_timer_close()
	   - snd_hrtimer_close()
	      - (struct snd_timer *) t-&gt;private_data = NULL
        - snd_timer_open()
           - snd_hrtimer_open()
              - kzalloc() fails; t-&gt;private_data is still NULL

    ioctl(SNDRV_TIMER_IOCTL_START)
     - snd_timer_user_start()
	- snd_timer_start()
	   - snd_timer_start1()
	      - snd_hrtimer_start()
		- t-&gt;private_data == NULL // boom

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: fix division by zero after SNDRV_TIMER_IOCTL_CONTINUE</title>
<updated>2016-09-15T06:27:54+00:00</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@oracle.com</email>
</author>
<published>2016-08-28T22:33:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6fd91313bfcfd44cebcb2a55dbeeb606ee3cd710'/>
<id>6fd91313bfcfd44cebcb2a55dbeeb606ee3cd710</id>
<content type='text'>
commit 6b760bb2c63a9e322c0e4a0b5daf335ad93d5a33 upstream.

I got this:

    divide error: 0000 [#1] PREEMPT SMP KASAN
    CPU: 1 PID: 1327 Comm: a.out Not tainted 4.8.0-rc2+ #189
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    task: ffff8801120a9580 task.stack: ffff8801120b0000
    RIP: 0010:[&lt;ffffffff82c8bd9a&gt;]  [&lt;ffffffff82c8bd9a&gt;] snd_hrtimer_callback+0x1da/0x3f0
    RSP: 0018:ffff88011aa87da8  EFLAGS: 00010006
    RAX: 0000000000004f76 RBX: ffff880112655e88 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffff880112655ea0 RDI: 0000000000000001
    RBP: ffff88011aa87e00 R08: ffff88013fff905c R09: ffff88013fff9048
    R10: ffff88013fff9050 R11: 00000001050a7b8c R12: ffff880114778a00
    R13: ffff880114778ab4 R14: ffff880114778b30 R15: 0000000000000000
    FS:  00007f071647c700(0000) GS:ffff88011aa80000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000603001 CR3: 0000000112021000 CR4: 00000000000006e0
    Stack:
     0000000000000000 ffff880114778ab8 ffff880112655ea0 0000000000004f76
     ffff880112655ec8 ffff880112655e80 ffff880112655e88 ffff88011aa98fc0
     00000000b97ccf2b dffffc0000000000 ffff88011aa98fc0 ffff88011aa87ef0
    Call Trace:
     &lt;IRQ&gt;
     [&lt;ffffffff813abce7&gt;] __hrtimer_run_queues+0x347/0xa00
     [&lt;ffffffff82c8bbc0&gt;] ? snd_hrtimer_close+0x130/0x130
     [&lt;ffffffff813ab9a0&gt;] ? retrigger_next_event+0x1b0/0x1b0
     [&lt;ffffffff813ae1a6&gt;] ? hrtimer_interrupt+0x136/0x4b0
     [&lt;ffffffff813ae220&gt;] hrtimer_interrupt+0x1b0/0x4b0
     [&lt;ffffffff8120f91e&gt;] local_apic_timer_interrupt+0x6e/0xf0
     [&lt;ffffffff81227ad3&gt;] ? kvm_guest_apic_eoi_write+0x13/0xc0
     [&lt;ffffffff83c35086&gt;] smp_apic_timer_interrupt+0x76/0xa0
     [&lt;ffffffff83c3416c&gt;] apic_timer_interrupt+0x8c/0xa0
     &lt;EOI&gt;
     [&lt;ffffffff83c3239c&gt;] ? _raw_spin_unlock_irqrestore+0x2c/0x60
     [&lt;ffffffff82c8185d&gt;] snd_timer_start1+0xdd/0x670
     [&lt;ffffffff82c87015&gt;] snd_timer_continue+0x45/0x80
     [&lt;ffffffff82c88100&gt;] snd_timer_user_ioctl+0x1030/0x2830
     [&lt;ffffffff8159f3a0&gt;] ? __follow_pte.isra.49+0x430/0x430
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff815a26fa&gt;] ? do_wp_page+0x3aa/0x1c90
     [&lt;ffffffff815aa4f8&gt;] ? handle_mm_fault+0xbc8/0x27f0
     [&lt;ffffffff815a9930&gt;] ? __pmd_alloc+0x370/0x370
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff816b0733&gt;] do_vfs_ioctl+0x193/0x1050
     [&lt;ffffffff816b05a0&gt;] ? ioctl_preallocate+0x200/0x200
     [&lt;ffffffff81002f2f&gt;] ? syscall_trace_enter+0x3cf/0xdb0
     [&lt;ffffffff815045ba&gt;] ? __context_tracking_exit.part.4+0x9a/0x1e0
     [&lt;ffffffff81002b60&gt;] ? exit_to_usermode_loop+0x190/0x190
     [&lt;ffffffff82001a97&gt;] ? check_preemption_disabled+0x37/0x1e0
     [&lt;ffffffff81d93889&gt;] ? security_file_ioctl+0x89/0xb0
     [&lt;ffffffff816b167f&gt;] SyS_ioctl+0x8f/0xc0
     [&lt;ffffffff816b15f0&gt;] ? do_vfs_ioctl+0x1050/0x1050
     [&lt;ffffffff81005524&gt;] do_syscall_64+0x1c4/0x4e0
     [&lt;ffffffff83c32b2a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    Code: e8 fc 42 7b fe 8b 0d 06 8a 50 03 49 0f af cf 48 85 c9 0f 88 7c 01 00 00 48 89 4d a8 e8 e0 42 7b fe 48 8b 45 c0 48 8b 4d a8 48 99 &lt;48&gt; f7 f9 49 01 c7 e8 cb 42 7b fe 48 8b 55 d0 48 b8 00 00 00 00
    RIP  [&lt;ffffffff82c8bd9a&gt;] snd_hrtimer_callback+0x1da/0x3f0
     RSP &lt;ffff88011aa87da8&gt;
    ---[ end trace 6aa380f756a21074 ]---

The problem happens when you call ioctl(SNDRV_TIMER_IOCTL_CONTINUE) on a
completely new/unused timer -- it will have -&gt;sticks == 0, which causes a
divide by 0 in snd_hrtimer_callback().

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 6b760bb2c63a9e322c0e4a0b5daf335ad93d5a33 upstream.

I got this:

    divide error: 0000 [#1] PREEMPT SMP KASAN
    CPU: 1 PID: 1327 Comm: a.out Not tainted 4.8.0-rc2+ #189
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
    task: ffff8801120a9580 task.stack: ffff8801120b0000
    RIP: 0010:[&lt;ffffffff82c8bd9a&gt;]  [&lt;ffffffff82c8bd9a&gt;] snd_hrtimer_callback+0x1da/0x3f0
    RSP: 0018:ffff88011aa87da8  EFLAGS: 00010006
    RAX: 0000000000004f76 RBX: ffff880112655e88 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffff880112655ea0 RDI: 0000000000000001
    RBP: ffff88011aa87e00 R08: ffff88013fff905c R09: ffff88013fff9048
    R10: ffff88013fff9050 R11: 00000001050a7b8c R12: ffff880114778a00
    R13: ffff880114778ab4 R14: ffff880114778b30 R15: 0000000000000000
    FS:  00007f071647c700(0000) GS:ffff88011aa80000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000603001 CR3: 0000000112021000 CR4: 00000000000006e0
    Stack:
     0000000000000000 ffff880114778ab8 ffff880112655ea0 0000000000004f76
     ffff880112655ec8 ffff880112655e80 ffff880112655e88 ffff88011aa98fc0
     00000000b97ccf2b dffffc0000000000 ffff88011aa98fc0 ffff88011aa87ef0
    Call Trace:
     &lt;IRQ&gt;
     [&lt;ffffffff813abce7&gt;] __hrtimer_run_queues+0x347/0xa00
     [&lt;ffffffff82c8bbc0&gt;] ? snd_hrtimer_close+0x130/0x130
     [&lt;ffffffff813ab9a0&gt;] ? retrigger_next_event+0x1b0/0x1b0
     [&lt;ffffffff813ae1a6&gt;] ? hrtimer_interrupt+0x136/0x4b0
     [&lt;ffffffff813ae220&gt;] hrtimer_interrupt+0x1b0/0x4b0
     [&lt;ffffffff8120f91e&gt;] local_apic_timer_interrupt+0x6e/0xf0
     [&lt;ffffffff81227ad3&gt;] ? kvm_guest_apic_eoi_write+0x13/0xc0
     [&lt;ffffffff83c35086&gt;] smp_apic_timer_interrupt+0x76/0xa0
     [&lt;ffffffff83c3416c&gt;] apic_timer_interrupt+0x8c/0xa0
     &lt;EOI&gt;
     [&lt;ffffffff83c3239c&gt;] ? _raw_spin_unlock_irqrestore+0x2c/0x60
     [&lt;ffffffff82c8185d&gt;] snd_timer_start1+0xdd/0x670
     [&lt;ffffffff82c87015&gt;] snd_timer_continue+0x45/0x80
     [&lt;ffffffff82c88100&gt;] snd_timer_user_ioctl+0x1030/0x2830
     [&lt;ffffffff8159f3a0&gt;] ? __follow_pte.isra.49+0x430/0x430
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff815a26fa&gt;] ? do_wp_page+0x3aa/0x1c90
     [&lt;ffffffff815aa4f8&gt;] ? handle_mm_fault+0xbc8/0x27f0
     [&lt;ffffffff815a9930&gt;] ? __pmd_alloc+0x370/0x370
     [&lt;ffffffff82c870d0&gt;] ? snd_timer_pause+0x80/0x80
     [&lt;ffffffff816b0733&gt;] do_vfs_ioctl+0x193/0x1050
     [&lt;ffffffff816b05a0&gt;] ? ioctl_preallocate+0x200/0x200
     [&lt;ffffffff81002f2f&gt;] ? syscall_trace_enter+0x3cf/0xdb0
     [&lt;ffffffff815045ba&gt;] ? __context_tracking_exit.part.4+0x9a/0x1e0
     [&lt;ffffffff81002b60&gt;] ? exit_to_usermode_loop+0x190/0x190
     [&lt;ffffffff82001a97&gt;] ? check_preemption_disabled+0x37/0x1e0
     [&lt;ffffffff81d93889&gt;] ? security_file_ioctl+0x89/0xb0
     [&lt;ffffffff816b167f&gt;] SyS_ioctl+0x8f/0xc0
     [&lt;ffffffff816b15f0&gt;] ? do_vfs_ioctl+0x1050/0x1050
     [&lt;ffffffff81005524&gt;] do_syscall_64+0x1c4/0x4e0
     [&lt;ffffffff83c32b2a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    Code: e8 fc 42 7b fe 8b 0d 06 8a 50 03 49 0f af cf 48 85 c9 0f 88 7c 01 00 00 48 89 4d a8 e8 e0 42 7b fe 48 8b 45 c0 48 8b 4d a8 48 99 &lt;48&gt; f7 f9 49 01 c7 e8 cb 42 7b fe 48 8b 55 d0 48 b8 00 00 00 00
    RIP  [&lt;ffffffff82c8bd9a&gt;] snd_hrtimer_callback+0x1da/0x3f0
     RSP &lt;ffff88011aa87da8&gt;
    ---[ end trace 6aa380f756a21074 ]---

The problem happens when you call ioctl(SNDRV_TIMER_IOCTL_CONTINUE) on a
completely new/unused timer -- it will have -&gt;sticks == 0, which causes a
divide by 0 in snd_hrtimer_callback().

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: fix NULL pointer dereference in read()/ioctl() race</title>
<updated>2016-09-15T06:27:54+00:00</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@oracle.com</email>
</author>
<published>2016-08-28T08:13:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6664ad65f31ecb35f4f7d8208036b5dbc7640740'/>
<id>6664ad65f31ecb35f4f7d8208036b5dbc7640740</id>
<content type='text'>
commit 11749e086b2766cccf6217a527ef5c5604ba069c upstream.

I got this with syzkaller:

    ==================================================================
    BUG: KASAN: null-ptr-deref on address 0000000000000020
    Read of size 32 by task syz-executor/22519
    CPU: 1 PID: 22519 Comm: syz-executor Not tainted 4.8.0-rc2+ #169
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2
    014
     0000000000000001 ffff880111a17a00 ffffffff81f9f141 ffff880111a17a90
     ffff880111a17c50 ffff880114584a58 ffff880114584a10 ffff880111a17a80
     ffffffff8161fe3f ffff880100000000 ffff880118d74a48 ffff880118d74a68
    Call Trace:
     [&lt;ffffffff81f9f141&gt;] dump_stack+0x83/0xb2
     [&lt;ffffffff8161fe3f&gt;] kasan_report_error+0x41f/0x4c0
     [&lt;ffffffff8161ff74&gt;] kasan_report+0x34/0x40
     [&lt;ffffffff82c84b54&gt;] ? snd_timer_user_read+0x554/0x790
     [&lt;ffffffff8161e79e&gt;] check_memory_region+0x13e/0x1a0
     [&lt;ffffffff8161e9c1&gt;] kasan_check_read+0x11/0x20
     [&lt;ffffffff82c84b54&gt;] snd_timer_user_read+0x554/0x790
     [&lt;ffffffff82c84600&gt;] ? snd_timer_user_info_compat.isra.5+0x2b0/0x2b0
     [&lt;ffffffff817d0831&gt;] ? proc_fault_inject_write+0x1c1/0x250
     [&lt;ffffffff817d0670&gt;] ? next_tgid+0x2a0/0x2a0
     [&lt;ffffffff8127c278&gt;] ? do_group_exit+0x108/0x330
     [&lt;ffffffff8174653a&gt;] ? fsnotify+0x72a/0xca0
     [&lt;ffffffff81674dfe&gt;] __vfs_read+0x10e/0x550
     [&lt;ffffffff82c84600&gt;] ? snd_timer_user_info_compat.isra.5+0x2b0/0x2b0
     [&lt;ffffffff81674cf0&gt;] ? do_sendfile+0xc50/0xc50
     [&lt;ffffffff81745e10&gt;] ? __fsnotify_update_child_dentry_flags+0x60/0x60
     [&lt;ffffffff8143fec6&gt;] ? kcov_ioctl+0x56/0x190
     [&lt;ffffffff81e5ada2&gt;] ? common_file_perm+0x2e2/0x380
     [&lt;ffffffff81746b0e&gt;] ? __fsnotify_parent+0x5e/0x2b0
     [&lt;ffffffff81d93536&gt;] ? security_file_permission+0x86/0x1e0
     [&lt;ffffffff816728f5&gt;] ? rw_verify_area+0xe5/0x2b0
     [&lt;ffffffff81675355&gt;] vfs_read+0x115/0x330
     [&lt;ffffffff81676371&gt;] SyS_read+0xd1/0x1a0
     [&lt;ffffffff816762a0&gt;] ? vfs_write+0x4b0/0x4b0
     [&lt;ffffffff82001c2c&gt;] ? __this_cpu_preempt_check+0x1c/0x20
     [&lt;ffffffff8150455a&gt;] ? __context_tracking_exit.part.4+0x3a/0x1e0
     [&lt;ffffffff816762a0&gt;] ? vfs_write+0x4b0/0x4b0
     [&lt;ffffffff81005524&gt;] do_syscall_64+0x1c4/0x4e0
     [&lt;ffffffff810052fc&gt;] ? syscall_return_slowpath+0x16c/0x1d0
     [&lt;ffffffff83c3276a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    ==================================================================

There are a couple of problems that I can see:

 - ioctl(SNDRV_TIMER_IOCTL_SELECT), which potentially sets
   tu-&gt;queue/tu-&gt;tqueue to NULL on memory allocation failure, so read()
   would get a NULL pointer dereference like the above splat

 - the same ioctl() can free tu-&gt;queue/to-&gt;tqueue which means read()
   could potentially see (and dereference) the freed pointer

We can fix both by taking the ioctl_lock mutex when dereferencing
-&gt;queue/-&gt;tqueue, since that's always held over all the ioctl() code.

Just looking at the code I find it likely that there are more problems
here such as tu-&gt;qhead pointing outside the buffer if the size is
changed concurrently using SNDRV_TIMER_IOCTL_PARAMS.

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 11749e086b2766cccf6217a527ef5c5604ba069c upstream.

I got this with syzkaller:

    ==================================================================
    BUG: KASAN: null-ptr-deref on address 0000000000000020
    Read of size 32 by task syz-executor/22519
    CPU: 1 PID: 22519 Comm: syz-executor Not tainted 4.8.0-rc2+ #169
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2
    014
     0000000000000001 ffff880111a17a00 ffffffff81f9f141 ffff880111a17a90
     ffff880111a17c50 ffff880114584a58 ffff880114584a10 ffff880111a17a80
     ffffffff8161fe3f ffff880100000000 ffff880118d74a48 ffff880118d74a68
    Call Trace:
     [&lt;ffffffff81f9f141&gt;] dump_stack+0x83/0xb2
     [&lt;ffffffff8161fe3f&gt;] kasan_report_error+0x41f/0x4c0
     [&lt;ffffffff8161ff74&gt;] kasan_report+0x34/0x40
     [&lt;ffffffff82c84b54&gt;] ? snd_timer_user_read+0x554/0x790
     [&lt;ffffffff8161e79e&gt;] check_memory_region+0x13e/0x1a0
     [&lt;ffffffff8161e9c1&gt;] kasan_check_read+0x11/0x20
     [&lt;ffffffff82c84b54&gt;] snd_timer_user_read+0x554/0x790
     [&lt;ffffffff82c84600&gt;] ? snd_timer_user_info_compat.isra.5+0x2b0/0x2b0
     [&lt;ffffffff817d0831&gt;] ? proc_fault_inject_write+0x1c1/0x250
     [&lt;ffffffff817d0670&gt;] ? next_tgid+0x2a0/0x2a0
     [&lt;ffffffff8127c278&gt;] ? do_group_exit+0x108/0x330
     [&lt;ffffffff8174653a&gt;] ? fsnotify+0x72a/0xca0
     [&lt;ffffffff81674dfe&gt;] __vfs_read+0x10e/0x550
     [&lt;ffffffff82c84600&gt;] ? snd_timer_user_info_compat.isra.5+0x2b0/0x2b0
     [&lt;ffffffff81674cf0&gt;] ? do_sendfile+0xc50/0xc50
     [&lt;ffffffff81745e10&gt;] ? __fsnotify_update_child_dentry_flags+0x60/0x60
     [&lt;ffffffff8143fec6&gt;] ? kcov_ioctl+0x56/0x190
     [&lt;ffffffff81e5ada2&gt;] ? common_file_perm+0x2e2/0x380
     [&lt;ffffffff81746b0e&gt;] ? __fsnotify_parent+0x5e/0x2b0
     [&lt;ffffffff81d93536&gt;] ? security_file_permission+0x86/0x1e0
     [&lt;ffffffff816728f5&gt;] ? rw_verify_area+0xe5/0x2b0
     [&lt;ffffffff81675355&gt;] vfs_read+0x115/0x330
     [&lt;ffffffff81676371&gt;] SyS_read+0xd1/0x1a0
     [&lt;ffffffff816762a0&gt;] ? vfs_write+0x4b0/0x4b0
     [&lt;ffffffff82001c2c&gt;] ? __this_cpu_preempt_check+0x1c/0x20
     [&lt;ffffffff8150455a&gt;] ? __context_tracking_exit.part.4+0x3a/0x1e0
     [&lt;ffffffff816762a0&gt;] ? vfs_write+0x4b0/0x4b0
     [&lt;ffffffff81005524&gt;] do_syscall_64+0x1c4/0x4e0
     [&lt;ffffffff810052fc&gt;] ? syscall_return_slowpath+0x16c/0x1d0
     [&lt;ffffffff83c3276a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    ==================================================================

There are a couple of problems that I can see:

 - ioctl(SNDRV_TIMER_IOCTL_SELECT), which potentially sets
   tu-&gt;queue/tu-&gt;tqueue to NULL on memory allocation failure, so read()
   would get a NULL pointer dereference like the above splat

 - the same ioctl() can free tu-&gt;queue/to-&gt;tqueue which means read()
   could potentially see (and dereference) the freed pointer

We can fix both by taking the ioctl_lock mutex when dereferencing
-&gt;queue/-&gt;tqueue, since that's always held over all the ioctl() code.

Just looking at the code I find it likely that there are more problems
here such as tu-&gt;qhead pointing outside the buffer if the size is
changed concurrently using SNDRV_TIMER_IOCTL_PARAMS.

Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix leak in events via snd_timer_user_tinterrupt</title>
<updated>2016-08-10T09:49:26+00:00</updated>
<author>
<name>Kangjie Lu</name>
<email>kangjielu@gmail.com</email>
</author>
<published>2016-05-03T20:44:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8fd58e050f90ed5d5161413c75a8a8271934566c'/>
<id>8fd58e050f90ed5d5161413c75a8a8271934566c</id>
<content type='text'>
commit e4ec8cc8039a7063e24204299b462bd1383184a5 upstream.

The stack object “r1” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit e4ec8cc8039a7063e24204299b462bd1383184a5 upstream.

The stack object “r1” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix leak in events via snd_timer_user_ccallback</title>
<updated>2016-08-10T09:49:26+00:00</updated>
<author>
<name>Kangjie Lu</name>
<email>kangjielu@gmail.com</email>
</author>
<published>2016-05-03T20:44:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3e6af33c73fb7ec7be8dedd01047162ef64a26a5'/>
<id>3e6af33c73fb7ec7be8dedd01047162ef64a26a5</id>
<content type='text'>
commit 9a47e9cff994f37f7f0dbd9ae23740d0f64f9fe6 upstream.

The stack object “r1” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 9a47e9cff994f37f7f0dbd9ae23740d0f64f9fe6 upstream.

The stack object “r1” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix leak in SNDRV_TIMER_IOCTL_PARAMS</title>
<updated>2016-08-10T09:49:26+00:00</updated>
<author>
<name>Kangjie Lu</name>
<email>kangjielu@gmail.com</email>
</author>
<published>2016-05-03T20:44:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=90bed827ea910f82ab17ee154f501b5ae71617e6'/>
<id>90bed827ea910f82ab17ee154f501b5ae71617e6</id>
<content type='text'>
commit cec8f96e49d9be372fdb0c3836dcf31ec71e457e upstream.

The stack object “tread” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit cec8f96e49d9be372fdb0c3836dcf31ec71e457e upstream.

The stack object “tread” has a total size of 32 bytes. Its field
“event” and “val” both contain 4 bytes padding. These 8 bytes
padding bytes are sent to user without being initialized.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix negative queue usage by racy accesses</title>
<updated>2016-07-27T16:47:38+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-07-04T12:02:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=547d982b7eeba37eba90597b2ba675e39dd2177d'/>
<id>547d982b7eeba37eba90597b2ba675e39dd2177d</id>
<content type='text'>
commit 3fa6993fef634e05d200d141a85df0b044572364 upstream.

The user timer tu-&gt;qused counter may go to a negative value when
multiple concurrent reads are performed since both the check and the
decrement of tu-&gt;qused are done in two individual locked contexts.
This results in bogus read outs, and the endless loop in the
user-space side.

The fix is to move the decrement of the tu-&gt;qused counter into the
same spinlock context as the zero-check of the counter.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 3fa6993fef634e05d200d141a85df0b044572364 upstream.

The user timer tu-&gt;qused counter may go to a negative value when
multiple concurrent reads are performed since both the check and the
decrement of tu-&gt;qused are done in two individual locked contexts.
This results in bogus read outs, and the endless loop in the
user-space side.

The fix is to move the decrement of the tu-&gt;qused counter into the
same spinlock context as the zero-check of the counter.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Use mod_timer() for rearming the system timer</title>
<updated>2016-04-20T06:41:53+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-04-01T10:28:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=57f21bd260958fbfda2ef819a7fa8a0054df0c68'/>
<id>57f21bd260958fbfda2ef819a7fa8a0054df0c68</id>
<content type='text'>
commit 4a07083ed613644c96c34a7dd2853dc5d7c70902 upstream.

ALSA system timer backend stops the timer via del_timer() without sync
and leaves del_timer_sync() at the close instead.  This is because of
the restriction by the design of ALSA timer: namely, the stop callback
may be called from the timer handler, and calling the sync shall lead
to a hangup.  However, this also triggers a kernel BUG() when the
timer is rearmed immediately after stopping without sync:
 kernel BUG at kernel/time/timer.c:966!
 Call Trace:
  &lt;IRQ&gt;
  [&lt;ffffffff8239c94e&gt;] snd_timer_s_start+0x13e/0x1a0
  [&lt;ffffffff8239e1f4&gt;] snd_timer_interrupt+0x504/0xec0
  [&lt;ffffffff8122fca0&gt;] ? debug_check_no_locks_freed+0x290/0x290
  [&lt;ffffffff8239ec64&gt;] snd_timer_s_function+0xb4/0x120
  [&lt;ffffffff81296b72&gt;] call_timer_fn+0x162/0x520
  [&lt;ffffffff81296add&gt;] ? call_timer_fn+0xcd/0x520
  [&lt;ffffffff8239ebb0&gt;] ? snd_timer_interrupt+0xec0/0xec0
  ....

It's the place where add_timer() checks the pending timer.  It's clear
that this may happen after the immediate restart without sync in our
cases.

So, the workaround here is just to use mod_timer() instead of
add_timer().  This looks like a band-aid fix, but it's a right move,
as snd_timer_interrupt() takes care of the continuous rearm of timer.

Reported-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 4a07083ed613644c96c34a7dd2853dc5d7c70902 upstream.

ALSA system timer backend stops the timer via del_timer() without sync
and leaves del_timer_sync() at the close instead.  This is because of
the restriction by the design of ALSA timer: namely, the stop callback
may be called from the timer handler, and calling the sync shall lead
to a hangup.  However, this also triggers a kernel BUG() when the
timer is rearmed immediately after stopping without sync:
 kernel BUG at kernel/time/timer.c:966!
 Call Trace:
  &lt;IRQ&gt;
  [&lt;ffffffff8239c94e&gt;] snd_timer_s_start+0x13e/0x1a0
  [&lt;ffffffff8239e1f4&gt;] snd_timer_interrupt+0x504/0xec0
  [&lt;ffffffff8122fca0&gt;] ? debug_check_no_locks_freed+0x290/0x290
  [&lt;ffffffff8239ec64&gt;] snd_timer_s_function+0xb4/0x120
  [&lt;ffffffff81296b72&gt;] call_timer_fn+0x162/0x520
  [&lt;ffffffff81296add&gt;] ? call_timer_fn+0xcd/0x520
  [&lt;ffffffff8239ebb0&gt;] ? snd_timer_interrupt+0xec0/0xec0
  ....

It's the place where add_timer() checks the pending timer.  It's clear
that this may happen after the immediate restart without sync in our
cases.

So, the workaround here is just to use mod_timer() instead of
add_timer().  This looks like a band-aid fix, but it's a right move,
as snd_timer_interrupt() takes care of the continuous rearm of timer.

Reported-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix race between stop and interrupt</title>
<updated>2016-02-17T20:31:00+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-02-09T11:02:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=92cc7c5788b090c2a15d5dfdfdcb772d9b25e91a'/>
<id>92cc7c5788b090c2a15d5dfdfdcb772d9b25e91a</id>
<content type='text'>
commit ed8b1d6d2c741ab26d60d499d7fbb7ac801f0f51 upstream.

A slave timer element also unlinks at snd_timer_stop() but it takes
only slave_active_lock.  When a slave is assigned to a master,
however, this may become a race against the master's interrupt
handling, eventually resulting in a list corruption.  The actual bug
could be seen with a syzkaller fuzzer test case in BugLink below.

As a fix, we need to take timeri-&gt;timer-&gt;lock when timer isn't NULL,
i.e. assigned to a master, while the assignment to a master itself is
protected by slave_active_lock.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit ed8b1d6d2c741ab26d60d499d7fbb7ac801f0f51 upstream.

A slave timer element also unlinks at snd_timer_stop() but it takes
only slave_active_lock.  When a slave is assigned to a master,
however, this may become a race against the master's interrupt
handling, eventually resulting in a list corruption.  The actual bug
could be seen with a syzkaller fuzzer test case in BugLink below.

As a fix, we need to take timeri-&gt;timer-&gt;lock when timer isn't NULL,
i.e. assigned to a master, while the assignment to a master itself is
protected by slave_active_lock.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix wrong instance passed to slave callbacks</title>
<updated>2016-02-17T20:31:00+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-02-08T16:36:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4333cce1e75701f5ffb0f17cbe43c170e09e7e46'/>
<id>4333cce1e75701f5ffb0f17cbe43c170e09e7e46</id>
<content type='text'>
commit 117159f0b9d392fb433a7871426fad50317f06f7 upstream.

In snd_timer_notify1(), the wrong timer instance was passed for slave
ccallback function.  This leads to the access to the wrong data when
an incompatible master is handled (e.g. the master is the sequencer
timer and the slave is a user timer), as spotted by syzkaller fuzzer.

This patch fixes that wrong assignment.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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>
commit 117159f0b9d392fb433a7871426fad50317f06f7 upstream.

In snd_timer_notify1(), the wrong timer instance was passed for slave
ccallback function.  This leads to the access to the wrong data when
an incompatible master is handled (e.g. the master is the sequencer
timer and the slave is a user timer), as spotted by syzkaller fuzzer.

This patch fixes that wrong assignment.

BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
