<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/sound/core/control.c, branch linux-3.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-11-11T13:34:30Z</updated>
<entry>
<title>ALSA: core: Fix unexpected error at replacing user TLV</title>
<updated>2017-11-11T13:34:30Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2017-08-22T06:15:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5bb5cc4ec4fa756070edf5e851fa9607dbf6d3a8'/>
<id>urn:sha1:5bb5cc4ec4fa756070edf5e851fa9607dbf6d3a8</id>
<content type='text'>
commit 88c54cdf61f508ebcf8da2d819f5dfc03e954d1d upstream.

When user tries to replace the user-defined control TLV, the kernel
checks the change of its content via memcmp().  The problem is that
the kernel passes the return value from memcmp() as is.  memcmp()
gives a non-zero negative value depending on the comparison result,
and this shall be recognized as an error code.

The patch covers that corner-case, return 1 properly for the changed
TLV.

Fixes: 8aa9b586e420 ("[ALSA] Control API - more robust TLV implementation")
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: ctl: Stop notification after disconnection</title>
<updated>2016-11-20T01:01:24Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2016-07-08T06:05:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=69d5af27ee4f7245fc1a18a444992578f804e2a7'/>
<id>urn:sha1:69d5af27ee4f7245fc1a18a444992578f804e2a7</id>
<content type='text'>
commit f388cdcdd160687c6650833f286b9c89c50960ff upstream.

snd_ctl_remove() has a notification for the removal event.  It's
superfluous when done during the device got disconnected.  Although
the notification itself is mostly harmless, it may potentially be
harmful, and should be suppressed.  Actually some components PCM may
free ctl elements during the disconnect or free callbacks, thus it's
no theoretical issue.

This patch adds the check of card-&gt;shutdown flag for avoiding
unnecessary notifications after (or during) the disconnect.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0</title>
<updated>2016-02-13T10:34:11Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2016-01-18T13:12:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c793373eea1dcd0102a4f09edea14d404da9629b'/>
<id>urn:sha1:c793373eea1dcd0102a4f09edea14d404da9629b</id>
<content type='text'>
commit c0bcdbdff3ff73a54161fca3cb8b6cdbd0bb8762 upstream.

When a TLV ioctl with numid zero is handled, the driver may spew a
kernel warning with a stack trace at each call.  The check was
intended obviously only for a kernel driver, but not for a user
interaction.  Let's fix it.

This was spotted by syzkaller fuzzer.

Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Add sanity checks for user ctl id name string</title>
<updated>2015-05-09T22:16:29Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2015-03-11T17:12:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0501b7e487eb6870f46e80275ab4cde3829baeea'/>
<id>urn:sha1:0501b7e487eb6870f46e80275ab4cde3829baeea</id>
<content type='text'>
commit be3bb8236db2d0fcd705062ae2e2a9d75131222f upstream.

There was no check about the id string of user control elements, so we
accepted even a control element with an empty string, which is
obviously bogus.  This patch adds more sanity checks of id strings.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Make sure that id-&gt;index does not overflow</title>
<updated>2014-07-11T12:33:52Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2014-06-18T11:32:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f7500568b7633324e7c4282bb8baa3ff3f17fd7a'/>
<id>urn:sha1:f7500568b7633324e7c4282bb8baa3ff3f17fd7a</id>
<content type='text'>
commit 883a1d49f0d77d30012f114b2e19fc141beb3e8e upstream.

The ALSA control code expects that the range of assigned indices to a control is
continuous and does not overflow. Currently there are no checks to enforce this.
If a control with a overflowing index range is created that control becomes
effectively inaccessible and unremovable since snd_ctl_find_id() will not be
able to find it. This patch adds a check that makes sure that controls with a
overflowing index range can not be created.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Acked-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Handle numid overflow</title>
<updated>2014-07-11T12:33:52Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2014-06-18T11:32:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e3ca27c942102af152aabb2d2a4ab5fa0abe7d95'/>
<id>urn:sha1:e3ca27c942102af152aabb2d2a4ab5fa0abe7d95</id>
<content type='text'>
commit ac902c112d90a89e59916f751c2745f4dbdbb4bd upstream.

Each control gets automatically assigned its numids when the control is created.
The allocation is done by incrementing the numid by the amount of allocated
numids per allocation. This means that excessive creation and destruction of
controls (e.g. via SNDRV_CTL_IOCTL_ELEM_ADD/REMOVE) can cause the id to
eventually overflow. Currently when this happens for the control that caused the
overflow kctl-&gt;id.numid + kctl-&gt;count will also over flow causing it to be
smaller than kctl-&gt;id.numid. Most of the code assumes that this is something
that can not happen, so we need to make sure that it won't happen

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Acked-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Don't access controls outside of protected regions</title>
<updated>2014-07-11T12:33:51Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2014-06-18T11:32:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=79b789d8e20e22196285ac98247b5aeee2cade17'/>
<id>urn:sha1:79b789d8e20e22196285ac98247b5aeee2cade17</id>
<content type='text'>
commit fd9f26e4eca5d08a27d12c0933fceef76ed9663d upstream.

A control that is visible on the card-&gt;controls list can be freed at any time.
This means we must not access any of its memory while not holding the
controls_rw_lock. Otherwise we risk a use after free access.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Acked-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Fix replacing user controls</title>
<updated>2014-07-11T12:33:51Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2014-06-18T11:32:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e2e43eca302b31f64ebfe4734fd2cc7358c4555'/>
<id>urn:sha1:0e2e43eca302b31f64ebfe4734fd2cc7358c4555</id>
<content type='text'>
commit 82262a46627bebb0febcc26664746c25cef08563 upstream.

There are two issues with the current implementation for replacing user
controls. The first is that the code does not check if the control is actually a
user control and neither does it check if the control is owned by the process
that tries to remove it. That allows userspace applications to remove arbitrary
controls, which can cause a user after free if a for example a driver does not
expect a control to be removed from under its feed.

The second issue is that on one hand when a control is replaced the
user_ctl_count limit is not checked and on the other hand the user_ctl_count is
increased (even though the number of user controls does not change). This allows
userspace, once the user_ctl_count limit as been reached, to repeatedly replace
a control until user_ctl_count overflows. Once that happens new controls can be
added effectively bypassing the user_ctl_count limit.

Both issues can be fixed by instead of open-coding the removal of the control
that is to be replaced to use snd_ctl_remove_user_ctl(). This function does
proper permission checks as well as decrements user_ctl_count after the control
has been removed.

Note that by using snd_ctl_remove_user_ctl() the check which returns -EBUSY at
beginning of the function if the control already exists is removed. This is not
a problem though since the check is quite useless, because the lock that is
protecting the control list is released between the check and before adding the
new control to the list, which means that it is possible that a different
control with the same settings is added to the list after the check. Luckily
there is another check that is done while holding the lock in snd_ctl_add(), so
we'll rely on that to make sure that the same control is not added twice.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Acked-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: control: Protect user controls against concurrent access</title>
<updated>2014-07-11T12:33:51Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2014-06-18T11:32:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a3e84b9fd584f2f41600a69fe3cc317b2c34b14'/>
<id>urn:sha1:7a3e84b9fd584f2f41600a69fe3cc317b2c34b14</id>
<content type='text'>
commit 07f4d9d74a04aa7c72c5dae0ef97565f28f17b92 upstream.

The user-control put and get handlers as well as the tlv do not protect against
concurrent access from multiple threads. Since the state of the control is not
updated atomically it is possible that either two write operations or a write
and a read operation race against each other. Both can lead to arbitrary memory
disclosure. This patch introduces a new lock that protects user-controls from
concurrent access. Since applications typically access controls sequentially
than in parallel a single lock per card should be fine.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Acked-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ALSA: Avoid endless sleep after disconnect</title>
<updated>2012-11-16T16:46:50Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2012-10-16T14:43:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=38638f09259204fd9e6c6486867d8e2771ec5a4d'/>
<id>urn:sha1:38638f09259204fd9e6c6486867d8e2771ec5a4d</id>
<content type='text'>
commit 0914f7961babbf28aaa2f19b453951fb4841c03f upstream.

When disconnect callback is called, each component should wake up
sleepers and check card-&gt;shutdown flag for avoiding the endless sleep
blocking the proper resource release.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
</feed>
