<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/sound, branch v4.8.2</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>ALSA: usb-line6: use the same declaration as definition in header for MIDI manufacturer ID</title>
<updated>2016-10-16T16:03:38+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2016-09-25T13:00:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=14ca6ce4528d834c9c2abe4b3423e58df2390c0f'/>
<id>14ca6ce4528d834c9c2abe4b3423e58df2390c0f</id>
<content type='text'>
commit 8da08ca03b73593d5299893bf29fc08569c3fb5f upstream.

Currently, usb-line6 module exports an array of MIDI manufacturer ID and
usb-pod module uses it. However, the declaration is not the definition in
common header. The difference is explicit length of array. Although
compiler calculates it and everything goes well, it's better to use the
same representation between definition and declaration.

This commit fills the length of array for usb-line6 module. As a small
good sub-effect, this commit suppress below warnings from static analysis
by sparse v0.5.0.

sound/usb/line6/driver.c:274:43: error: cannot size expression
sound/usb/line6/driver.c:275:16: error: cannot size expression
sound/usb/line6/driver.c:276:16: error: cannot size expression
sound/usb/line6/driver.c:277:16: error: cannot size expression

Fixes: 705ececd1c60 ("Staging: add line6 usb driver")
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&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 8da08ca03b73593d5299893bf29fc08569c3fb5f upstream.

Currently, usb-line6 module exports an array of MIDI manufacturer ID and
usb-pod module uses it. However, the declaration is not the definition in
common header. The difference is explicit length of array. Although
compiler calculates it and everything goes well, it's better to use the
same representation between definition and declaration.

This commit fills the length of array for usb-line6 module. As a small
good sub-effect, this commit suppress below warnings from static analysis
by sparse v0.5.0.

sound/usb/line6/driver.c:274:43: error: cannot size expression
sound/usb/line6/driver.c:275:16: error: cannot size expression
sound/usb/line6/driver.c:276:16: error: cannot size expression
sound/usb/line6/driver.c:277:16: error: cannot size expression

Fixes: 705ececd1c60 ("Staging: add line6 usb driver")
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&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: usb-audio: Extend DragonFly dB scale quirk to cover other variants</title>
<updated>2016-10-16T16:03:38+00:00</updated>
<author>
<name>Anssi Hannula</name>
<email>anssi.hannula@iki.fi</email>
</author>
<published>2016-09-23T03:43:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e09db64b3e100e7c021b8d34ef2f92c888eec95b'/>
<id>e09db64b3e100e7c021b8d34ef2f92c888eec95b</id>
<content type='text'>
commit eb1a74b7bea17eea31915c4f76385cefe69d9795 upstream.

The DragonFly quirk added in 42e3121d90f4 ("ALSA: usb-audio: Add a more
accurate volume quirk for AudioQuest DragonFly") applies a custom dB map
on the volume control when its range is reported as 0..50 (0 .. 0.2dB).

However, there exists at least one other variant (hw v1.0c, as opposed
to the tested v1.2) which reports a different non-sensical volume range
(0..53) and the custom map is therefore not applied for that device.

This results in all of the volume change appearing close to 100% on
mixer UIs that utilize the dB TLV information.

Add a fallback case where no dB TLV is reported at all if the control
range is not 0..50 but still 0..N where N &lt;= 1000 (3.9 dB). Also
restrict the quirk to only apply to the volume control as there is also
a mute control which would match the check otherwise.

Fixes: 42e3121d90f4 ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly")
Signed-off-by: Anssi Hannula &lt;anssi.hannula@iki.fi&gt;
Reported-by: David W &lt;regulars@d-dub.org.uk&gt;
Tested-by: David W &lt;regulars@d-dub.org.uk&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 eb1a74b7bea17eea31915c4f76385cefe69d9795 upstream.

The DragonFly quirk added in 42e3121d90f4 ("ALSA: usb-audio: Add a more
accurate volume quirk for AudioQuest DragonFly") applies a custom dB map
on the volume control when its range is reported as 0..50 (0 .. 0.2dB).

However, there exists at least one other variant (hw v1.0c, as opposed
to the tested v1.2) which reports a different non-sensical volume range
(0..53) and the custom map is therefore not applied for that device.

This results in all of the volume change appearing close to 100% on
mixer UIs that utilize the dB TLV information.

Add a fallback case where no dB TLV is reported at all if the control
range is not 0..50 but still 0..N where N &lt;= 1000 (3.9 dB). Also
restrict the quirk to only apply to the volume control as there is also
a mute control which would match the check otherwise.

Fixes: 42e3121d90f4 ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly")
Signed-off-by: Anssi Hannula &lt;anssi.hannula@iki.fi&gt;
Reported-by: David W &lt;regulars@d-dub.org.uk&gt;
Tested-by: David W &lt;regulars@d-dub.org.uk&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: ali5451: Fix out-of-bound position reporting</title>
<updated>2016-10-16T16:03:38+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-09-21T12:38:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=80e84e00f9c9acbea67bf8badd284ab033da2fbe'/>
<id>80e84e00f9c9acbea67bf8badd284ab033da2fbe</id>
<content type='text'>
commit db68577966abc1aeae4ec597b3dcfa0d56e92041 upstream.

The pointer callbacks of ali5451 driver may return the value at the
boundary occasionally, and it results in the kernel warning like
  snd_ali5451 0000:00:06.0: BUG: , pos = 16384, buffer size = 16384, period size = 1024

It seems that folding the position offset is enough for fixing the
warning and no ill-effect has been seen by that.

Reported-by: Enrico Mioso &lt;mrkiko.rs@gmail.com&gt;
Tested-by: Enrico Mioso &lt;mrkiko.rs@gmail.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 db68577966abc1aeae4ec597b3dcfa0d56e92041 upstream.

The pointer callbacks of ali5451 driver may return the value at the
boundary occasionally, and it results in the kernel warning like
  snd_ali5451 0000:00:06.0: BUG: , pos = 16384, buffer size = 16384, period size = 1024

It seems that folding the position offset is enough for fixing the
warning and no ill-effect has been seen by that.

Reported-by: Enrico Mioso &lt;mrkiko.rs@gmail.com&gt;
Tested-by: Enrico Mioso &lt;mrkiko.rs@gmail.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: hda - Add the top speaker pin config for HP Spectre x360</title>
<updated>2016-10-07T13:03:20+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-09-27T14:44:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8cf61e57d856a29d227700ab212bb5d6e706003e'/>
<id>8cf61e57d856a29d227700ab212bb5d6e706003e</id>
<content type='text'>
commit 0eec880966e77bdbee0112989a2be67d92e39929 upstream.

HP Spectre x360 with CX20724 codec has two speaker outputs while the
BIOS sets up only the bottom one (NID 0x17) and disables the top one
(NID 0x1d).

This patch adds a fixup simply defining the proper pincfg for NID 0x1d
so that the top speaker works as is.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=169071
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 0eec880966e77bdbee0112989a2be67d92e39929 upstream.

HP Spectre x360 with CX20724 codec has two speaker outputs while the
BIOS sets up only the bottom one (NID 0x17) and disables the top one
(NID 0x1d).

This patch adds a fixup simply defining the proper pincfg for NID 0x1d
so that the top speaker works as is.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=169071
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: hda - Fix headset mic detection problem for several Dell laptops</title>
<updated>2016-10-07T13:03:20+00:00</updated>
<author>
<name>Hui Wang</name>
<email>hui.wang@canonical.com</email>
</author>
<published>2016-09-11T03:26:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=35e0251bfab3d9cf6874153e7ffb6f6619f8b900'/>
<id>35e0251bfab3d9cf6874153e7ffb6f6619f8b900</id>
<content type='text'>
commit 3f640970a41429f0a076c01270bbd014c9eae61c upstream.

One of the laptops has the codec ALC256 on it, applying the
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE can fix the problem, the rest
of laptops have the codec ALC295 on them, they are similar to machines
with ALC225, applying the ALC269_FIXUP_DELL1_MIC_NO_PRESENCE can fix
the problem.

Signed-off-by: Hui Wang &lt;hui.wang@canonical.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 3f640970a41429f0a076c01270bbd014c9eae61c upstream.

One of the laptops has the codec ALC256 on it, applying the
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE can fix the problem, the rest
of laptops have the codec ALC295 on them, they are similar to machines
with ALC225, applying the ALC269_FIXUP_DELL1_MIC_NO_PRESENCE can fix
the problem.

Signed-off-by: Hui Wang &lt;hui.wang@canonical.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: hda - Adding one more ALC255 pin definition for headset problem</title>
<updated>2016-10-07T13:03:20+00:00</updated>
<author>
<name>Hui Wang</name>
<email>hui.wang@canonical.com</email>
</author>
<published>2016-09-26T02:59:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f090888f591096fafe2c89054dc6fd79b60e8c08'/>
<id>f090888f591096fafe2c89054dc6fd79b60e8c08</id>
<content type='text'>
commit 392c9da24a994f238c5d7ea611c6245be4617014 upstream.

We have two new Dell laptop models, they have the same ALC255 pin
definition, but not in the pin quirk table yet, as a result, the
headset microphone can't work. After adding the definition in the
table, the headset microphone works well.

Signed-off-by: Hui Wang &lt;hui.wang@canonical.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 392c9da24a994f238c5d7ea611c6245be4617014 upstream.

We have two new Dell laptop models, they have the same ALC255 pin
definition, but not in the pin quirk table yet, as a result, the
headset microphone can't work. After adding the definition in the
table, the headset microphone works well.

Signed-off-by: Hui Wang &lt;hui.wang@canonical.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: rawmidi: Fix possible deadlock with virmidi registration</title>
<updated>2016-09-08T08:45:20+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-08-30T12:45:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=816f318b2364262a51024096da7ca3b84e78e3b5'/>
<id>816f318b2364262a51024096da7ca3b84e78e3b5</id>
<content type='text'>
When a seq-virmidi driver is initialized, it registers a rawmidi
instance with its callback to create an associated seq kernel client.
Currently it's done throughly in rawmidi's register_mutex context.
Recently it was found that this may lead to a deadlock another rawmidi
device that is being attached with the sequencer is accessed, as both
open with the same register_mutex.  This was actually triggered by
syzkaller, as Dmitry Vyukov reported:

======================================================
 [ INFO: possible circular locking dependency detected ]
 4.8.0-rc1+ #11 Not tainted
 -------------------------------------------------------
 syz-executor/7154 is trying to acquire lock:
  (register_mutex#5){+.+.+.}, at: [&lt;ffffffff84fd6d4b&gt;] snd_rawmidi_kernel_open+0x4b/0x260 sound/core/rawmidi.c:341

 but task is already holding lock:
  (&amp;grp-&gt;list_mutex){++++.+}, at: [&lt;ffffffff850138bb&gt;] check_and_subscribe_port+0x5b/0x5c0 sound/core/seq/seq_ports.c:495

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -&gt; #1 (&amp;grp-&gt;list_mutex){++++.+}:
    [&lt;ffffffff8147a3a8&gt;] lock_acquire+0x208/0x430 kernel/locking/lockdep.c:3746
    [&lt;ffffffff863f6199&gt;] down_read+0x49/0xc0 kernel/locking/rwsem.c:22
    [&lt;     inline     &gt;] deliver_to_subscribers sound/core/seq/seq_clientmgr.c:681
    [&lt;ffffffff85005c5e&gt;] snd_seq_deliver_event+0x35e/0x890 sound/core/seq/seq_clientmgr.c:822
    [&lt;ffffffff85006e96&gt;] &gt; snd_seq_kernel_client_dispatch+0x126/0x170 sound/core/seq/seq_clientmgr.c:2418
    [&lt;ffffffff85012c52&gt;] snd_seq_system_broadcast+0xb2/0xf0 sound/core/seq/seq_system.c:101
    [&lt;ffffffff84fff70a&gt;] snd_seq_create_kernel_client+0x24a/0x330 sound/core/seq/seq_clientmgr.c:2297
    [&lt;     inline     &gt;] snd_virmidi_dev_attach_seq sound/core/seq/seq_virmidi.c:383
    [&lt;ffffffff8502d29f&gt;] snd_virmidi_dev_register+0x29f/0x750 sound/core/seq/seq_virmidi.c:450
    [&lt;ffffffff84fd208c&gt;] snd_rawmidi_dev_register+0x30c/0xd40 sound/core/rawmidi.c:1645
    [&lt;ffffffff84f816d3&gt;] __snd_device_register.part.0+0x63/0xc0 sound/core/device.c:164
    [&lt;     inline     &gt;] __snd_device_register sound/core/device.c:162
    [&lt;ffffffff84f8235d&gt;] snd_device_register_all+0xad/0x110 sound/core/device.c:212
    [&lt;ffffffff84f7546f&gt;] snd_card_register+0xef/0x6c0 sound/core/init.c:749
    [&lt;ffffffff85040b7f&gt;] snd_virmidi_probe+0x3ef/0x590 sound/drivers/virmidi.c:123
    [&lt;ffffffff833ebf7b&gt;] platform_drv_probe+0x8b/0x170 drivers/base/platform.c:564
    ......

 -&gt; #0 (register_mutex#5){+.+.+.}:
    [&lt;     inline     &gt;] check_prev_add kernel/locking/lockdep.c:1829
    [&lt;     inline     &gt;] check_prevs_add kernel/locking/lockdep.c:1939
    [&lt;     inline     &gt;] validate_chain kernel/locking/lockdep.c:2266
    [&lt;ffffffff814791f4&gt;] __lock_acquire+0x4d44/0x4d80 kernel/locking/lockdep.c:3335
    [&lt;ffffffff8147a3a8&gt;] lock_acquire+0x208/0x430 kernel/locking/lockdep.c:3746
    [&lt;     inline     &gt;] __mutex_lock_common kernel/locking/mutex.c:521
    [&lt;ffffffff863f0ef1&gt;] mutex_lock_nested+0xb1/0xa20 kernel/locking/mutex.c:621
    [&lt;ffffffff84fd6d4b&gt;] snd_rawmidi_kernel_open+0x4b/0x260 sound/core/rawmidi.c:341
    [&lt;ffffffff8502e7c7&gt;] midisynth_subscribe+0xf7/0x350 sound/core/seq/seq_midi.c:188
    [&lt;     inline     &gt;] subscribe_port sound/core/seq/seq_ports.c:427
    [&lt;ffffffff85013cc7&gt;] check_and_subscribe_port+0x467/0x5c0 sound/core/seq/seq_ports.c:510
    [&lt;ffffffff85015da9&gt;] snd_seq_port_connect+0x2c9/0x500 sound/core/seq/seq_ports.c:579
    [&lt;ffffffff850079b8&gt;] snd_seq_ioctl_subscribe_port+0x1d8/0x2b0 sound/core/seq/seq_clientmgr.c:1480
    [&lt;ffffffff84ffe9e4&gt;] snd_seq_do_ioctl+0x184/0x1e0 sound/core/seq/seq_clientmgr.c:2225
    [&lt;ffffffff84ffeae8&gt;] snd_seq_kernel_client_ctl+0xa8/0x110 sound/core/seq/seq_clientmgr.c:2440
    [&lt;ffffffff85027664&gt;] snd_seq_oss_midi_open+0x3b4/0x610 sound/core/seq/oss/seq_oss_midi.c:375
    [&lt;ffffffff85023d67&gt;] snd_seq_oss_synth_setup_midi+0x107/0x4c0 sound/core/seq/oss/seq_oss_synth.c:281
    [&lt;ffffffff8501b0a8&gt;] snd_seq_oss_open+0x748/0x8d0 sound/core/seq/oss/seq_oss_init.c:274
    [&lt;ffffffff85019d8a&gt;] odev_open+0x6a/0x90 sound/core/seq/oss/seq_oss.c:138
    [&lt;ffffffff84f7040f&gt;] soundcore_open+0x30f/0x640 sound/sound_core.c:639
    ......

 other info that might help us debug this:

 Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(&amp;grp-&gt;list_mutex);
                                lock(register_mutex#5);
                                lock(&amp;grp-&gt;list_mutex);
   lock(register_mutex#5);

 *** DEADLOCK ***
======================================================

The fix is to simply move the registration parts in
snd_rawmidi_dev_register() to the outside of the register_mutex lock.
The lock is needed only to manage the linked list, and it's not
necessarily to cover the whole initialization process.

Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a seq-virmidi driver is initialized, it registers a rawmidi
instance with its callback to create an associated seq kernel client.
Currently it's done throughly in rawmidi's register_mutex context.
Recently it was found that this may lead to a deadlock another rawmidi
device that is being attached with the sequencer is accessed, as both
open with the same register_mutex.  This was actually triggered by
syzkaller, as Dmitry Vyukov reported:

======================================================
 [ INFO: possible circular locking dependency detected ]
 4.8.0-rc1+ #11 Not tainted
 -------------------------------------------------------
 syz-executor/7154 is trying to acquire lock:
  (register_mutex#5){+.+.+.}, at: [&lt;ffffffff84fd6d4b&gt;] snd_rawmidi_kernel_open+0x4b/0x260 sound/core/rawmidi.c:341

 but task is already holding lock:
  (&amp;grp-&gt;list_mutex){++++.+}, at: [&lt;ffffffff850138bb&gt;] check_and_subscribe_port+0x5b/0x5c0 sound/core/seq/seq_ports.c:495

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -&gt; #1 (&amp;grp-&gt;list_mutex){++++.+}:
    [&lt;ffffffff8147a3a8&gt;] lock_acquire+0x208/0x430 kernel/locking/lockdep.c:3746
    [&lt;ffffffff863f6199&gt;] down_read+0x49/0xc0 kernel/locking/rwsem.c:22
    [&lt;     inline     &gt;] deliver_to_subscribers sound/core/seq/seq_clientmgr.c:681
    [&lt;ffffffff85005c5e&gt;] snd_seq_deliver_event+0x35e/0x890 sound/core/seq/seq_clientmgr.c:822
    [&lt;ffffffff85006e96&gt;] &gt; snd_seq_kernel_client_dispatch+0x126/0x170 sound/core/seq/seq_clientmgr.c:2418
    [&lt;ffffffff85012c52&gt;] snd_seq_system_broadcast+0xb2/0xf0 sound/core/seq/seq_system.c:101
    [&lt;ffffffff84fff70a&gt;] snd_seq_create_kernel_client+0x24a/0x330 sound/core/seq/seq_clientmgr.c:2297
    [&lt;     inline     &gt;] snd_virmidi_dev_attach_seq sound/core/seq/seq_virmidi.c:383
    [&lt;ffffffff8502d29f&gt;] snd_virmidi_dev_register+0x29f/0x750 sound/core/seq/seq_virmidi.c:450
    [&lt;ffffffff84fd208c&gt;] snd_rawmidi_dev_register+0x30c/0xd40 sound/core/rawmidi.c:1645
    [&lt;ffffffff84f816d3&gt;] __snd_device_register.part.0+0x63/0xc0 sound/core/device.c:164
    [&lt;     inline     &gt;] __snd_device_register sound/core/device.c:162
    [&lt;ffffffff84f8235d&gt;] snd_device_register_all+0xad/0x110 sound/core/device.c:212
    [&lt;ffffffff84f7546f&gt;] snd_card_register+0xef/0x6c0 sound/core/init.c:749
    [&lt;ffffffff85040b7f&gt;] snd_virmidi_probe+0x3ef/0x590 sound/drivers/virmidi.c:123
    [&lt;ffffffff833ebf7b&gt;] platform_drv_probe+0x8b/0x170 drivers/base/platform.c:564
    ......

 -&gt; #0 (register_mutex#5){+.+.+.}:
    [&lt;     inline     &gt;] check_prev_add kernel/locking/lockdep.c:1829
    [&lt;     inline     &gt;] check_prevs_add kernel/locking/lockdep.c:1939
    [&lt;     inline     &gt;] validate_chain kernel/locking/lockdep.c:2266
    [&lt;ffffffff814791f4&gt;] __lock_acquire+0x4d44/0x4d80 kernel/locking/lockdep.c:3335
    [&lt;ffffffff8147a3a8&gt;] lock_acquire+0x208/0x430 kernel/locking/lockdep.c:3746
    [&lt;     inline     &gt;] __mutex_lock_common kernel/locking/mutex.c:521
    [&lt;ffffffff863f0ef1&gt;] mutex_lock_nested+0xb1/0xa20 kernel/locking/mutex.c:621
    [&lt;ffffffff84fd6d4b&gt;] snd_rawmidi_kernel_open+0x4b/0x260 sound/core/rawmidi.c:341
    [&lt;ffffffff8502e7c7&gt;] midisynth_subscribe+0xf7/0x350 sound/core/seq/seq_midi.c:188
    [&lt;     inline     &gt;] subscribe_port sound/core/seq/seq_ports.c:427
    [&lt;ffffffff85013cc7&gt;] check_and_subscribe_port+0x467/0x5c0 sound/core/seq/seq_ports.c:510
    [&lt;ffffffff85015da9&gt;] snd_seq_port_connect+0x2c9/0x500 sound/core/seq/seq_ports.c:579
    [&lt;ffffffff850079b8&gt;] snd_seq_ioctl_subscribe_port+0x1d8/0x2b0 sound/core/seq/seq_clientmgr.c:1480
    [&lt;ffffffff84ffe9e4&gt;] snd_seq_do_ioctl+0x184/0x1e0 sound/core/seq/seq_clientmgr.c:2225
    [&lt;ffffffff84ffeae8&gt;] snd_seq_kernel_client_ctl+0xa8/0x110 sound/core/seq/seq_clientmgr.c:2440
    [&lt;ffffffff85027664&gt;] snd_seq_oss_midi_open+0x3b4/0x610 sound/core/seq/oss/seq_oss_midi.c:375
    [&lt;ffffffff85023d67&gt;] snd_seq_oss_synth_setup_midi+0x107/0x4c0 sound/core/seq/oss/seq_oss_synth.c:281
    [&lt;ffffffff8501b0a8&gt;] snd_seq_oss_open+0x748/0x8d0 sound/core/seq/oss/seq_oss_init.c:274
    [&lt;ffffffff85019d8a&gt;] odev_open+0x6a/0x90 sound/core/seq/oss/seq_oss.c:138
    [&lt;ffffffff84f7040f&gt;] soundcore_open+0x30f/0x640 sound/sound_core.c:639
    ......

 other info that might help us debug this:

 Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(&amp;grp-&gt;list_mutex);
                                lock(register_mutex#5);
                                lock(&amp;grp-&gt;list_mutex);
   lock(register_mutex#5);

 *** DEADLOCK ***
======================================================

The fix is to simply move the registration parts in
snd_rawmidi_dev_register() to the outside of the register_mutex lock.
The lock is needed only to manage the linked list, and it's not
necessarily to cover the whole initialization process.

Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: Fix zero-division by continue of uninitialized instance</title>
<updated>2016-09-08T08:45:05+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-09-07T13:45:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9f8a7658bcafb2a7853f7a2eae8a94e87e6e695b'/>
<id>9f8a7658bcafb2a7853f7a2eae8a94e87e6e695b</id>
<content type='text'>
When a user timer instance is continued without the explicit start
beforehand, the system gets eventually zero-division error like:

  divide error: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN
  CPU: 1 PID: 27320 Comm: syz-executor Not tainted 4.8.0-rc3-next-20160825+ #8
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
   task: ffff88003c9b2280 task.stack: ffff880027280000
   RIP: 0010:[&lt;ffffffff858e1a6c&gt;]  [&lt;     inline     &gt;] ktime_divns include/linux/ktime.h:195
   RIP: 0010:[&lt;ffffffff858e1a6c&gt;]  [&lt;ffffffff858e1a6c&gt;] snd_hrtimer_callback+0x1bc/0x3c0 sound/core/hrtimer.c:62
  Call Trace:
   &lt;IRQ&gt;
   [&lt;     inline     &gt;] __run_hrtimer kernel/time/hrtimer.c:1238
   [&lt;ffffffff81504335&gt;] __hrtimer_run_queues+0x325/0xe70 kernel/time/hrtimer.c:1302
   [&lt;ffffffff81506ceb&gt;] hrtimer_interrupt+0x18b/0x420 kernel/time/hrtimer.c:1336
   [&lt;ffffffff8126d8df&gt;] local_apic_timer_interrupt+0x6f/0xe0 arch/x86/kernel/apic/apic.c:933
   [&lt;ffffffff86e13056&gt;] smp_apic_timer_interrupt+0x76/0xa0 arch/x86/kernel/apic/apic.c:957
   [&lt;ffffffff86e1210c&gt;] apic_timer_interrupt+0x8c/0xa0 arch/x86/entry/entry_64.S:487
   &lt;EOI&gt;
   .....

Although a similar issue was spotted and a fix patch was merged in
commit [6b760bb2c63a: ALSA: timer: fix division by zero after
SNDRV_TIMER_IOCTL_CONTINUE], it seems covering only a part of
iceberg.

In this patch, we fix the issue a bit more drastically.  Basically the
continue of an uninitialized timer is supposed to be a fresh start, so
we do it for user timers.  For the direct snd_timer_continue() call,
there is no way to pass the initial tick value, so we kick out for the
uninitialized case.

Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a user timer instance is continued without the explicit start
beforehand, the system gets eventually zero-division error like:

  divide error: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN
  CPU: 1 PID: 27320 Comm: syz-executor Not tainted 4.8.0-rc3-next-20160825+ #8
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
   task: ffff88003c9b2280 task.stack: ffff880027280000
   RIP: 0010:[&lt;ffffffff858e1a6c&gt;]  [&lt;     inline     &gt;] ktime_divns include/linux/ktime.h:195
   RIP: 0010:[&lt;ffffffff858e1a6c&gt;]  [&lt;ffffffff858e1a6c&gt;] snd_hrtimer_callback+0x1bc/0x3c0 sound/core/hrtimer.c:62
  Call Trace:
   &lt;IRQ&gt;
   [&lt;     inline     &gt;] __run_hrtimer kernel/time/hrtimer.c:1238
   [&lt;ffffffff81504335&gt;] __hrtimer_run_queues+0x325/0xe70 kernel/time/hrtimer.c:1302
   [&lt;ffffffff81506ceb&gt;] hrtimer_interrupt+0x18b/0x420 kernel/time/hrtimer.c:1336
   [&lt;ffffffff8126d8df&gt;] local_apic_timer_interrupt+0x6f/0xe0 arch/x86/kernel/apic/apic.c:933
   [&lt;ffffffff86e13056&gt;] smp_apic_timer_interrupt+0x76/0xa0 arch/x86/kernel/apic/apic.c:957
   [&lt;ffffffff86e1210c&gt;] apic_timer_interrupt+0x8c/0xa0 arch/x86/entry/entry_64.S:487
   &lt;EOI&gt;
   .....

Although a similar issue was spotted and a fix patch was merged in
commit [6b760bb2c63a: ALSA: timer: fix division by zero after
SNDRV_TIMER_IOCTL_CONTINUE], it seems covering only a part of
iceberg.

In this patch, we fix the issue a bit more drastically.  Basically the
continue of an uninitialized timer is supposed to be a fresh start, so
we do it for user timers.  For the direct snd_timer_continue() call,
there is no way to pass the initial tick value, so we kick out for the
uninitialized case.

Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: timer: fix NULL pointer dereference in read()/ioctl() race</title>
<updated>2016-09-02T13:13:08+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.tavy.me/linux-stable.git/commit/?id=11749e086b2766cccf6217a527ef5c5604ba069c'/>
<id>11749e086b2766cccf6217a527ef5c5604ba069c</id>
<content type='text'>
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;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ALSA: fireworks: accessing to user space outside spinlock</title>
<updated>2016-08-31T14:17:15+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2016-08-31T13:58:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6b1ca4bcadf9ef077cc5f03c6822ba276ed14902'/>
<id>6b1ca4bcadf9ef077cc5f03c6822ba276ed14902</id>
<content type='text'>
In hwdep interface of fireworks driver, accessing to user space is in a
critical section with disabled local interrupt. Depending on architecture,
accessing to user space can cause page fault exception. Then local
processor stores machine status and handles the synchronous event. A
handler corresponding to the event can call task scheduler to wait for
preparing pages. In a case of usage of single core processor, the state to
disable local interrupt is worse because it don't handle usual interrupts
from hardware.

This commit fixes this bug, performing the accessing outside spinlock. This
commit also gives up counting the number of queued response messages to
simplify ring-buffer management.

Reported-by: Vaishali Thakkar &lt;vaishali.thakkar@oracle.com&gt;
Cc: stable@vger.kernel.org
Fixes: 555e8a8f7f14('ALSA: fireworks: Add command/response functionality into hwdep interface')
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In hwdep interface of fireworks driver, accessing to user space is in a
critical section with disabled local interrupt. Depending on architecture,
accessing to user space can cause page fault exception. Then local
processor stores machine status and handles the synchronous event. A
handler corresponding to the event can call task scheduler to wait for
preparing pages. In a case of usage of single core processor, the state to
disable local interrupt is worse because it don't handle usual interrupts
from hardware.

This commit fixes this bug, performing the accessing outside spinlock. This
commit also gives up counting the number of queued response messages to
simplify ring-buffer management.

Reported-by: Vaishali Thakkar &lt;vaishali.thakkar@oracle.com&gt;
Cc: stable@vger.kernel.org
Fixes: 555e8a8f7f14('ALSA: fireworks: Add command/response functionality into hwdep interface')
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</pre>
</div>
</content>
</entry>
</feed>
