<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/sound/core/pcm.c, branch linux-4.16.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.16.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-4.16.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-04-24T07:43:01+00:00</updated>
<entry>
<title>ALSA: pcm: Fix UAF at PCM release via PCM timer access</title>
<updated>2018-04-24T07:43:01+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2018-04-02T20:41:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bfb9c474ebfad3851602c7ed6175b7ba651eac62'/>
<id>urn:sha1:bfb9c474ebfad3851602c7ed6175b7ba651eac62</id>
<content type='text'>
commit a820ccbe21e8ce8e86c39cd1d3bc8c7d1cbb949b upstream.

The PCM runtime object is created and freed dynamically at PCM stream
open / close time.  This is tracked via substream-&gt;runtime, and it's
cleared at snd_pcm_detach_substream().

The runtime object assignment is protected by PCM open_mutex, so for
all PCM operations, it's safely handled.  However, each PCM substream
provides also an ALSA timer interface, and user-space can access to
this while closing a PCM substream.  This may eventually lead to a
UAF, as snd_pcm_timer_resolution() tries to access the runtime while
clearing it in other side.

Fortunately, it's the only concurrent access from the PCM timer, and
it merely reads runtime-&gt;timer_resolution field.  So, we can avoid the
race by reordering kfree() and wrapping the substream-&gt;runtime
clearance with the corresponding timer lock.

Reported-by: syzbot+8e62ff4e07aa2ce87826@syzkaller.appspotmail.com
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ALSA: pcm: prevent UAF in snd_pcm_info</title>
<updated>2017-12-05T22:28:08+00:00</updated>
<author>
<name>Robb Glasser</name>
<email>rglasser@google.com</email>
</author>
<published>2017-12-05T17:16:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=362bca57f5d78220f8b5907b875961af9436e229'/>
<id>urn:sha1:362bca57f5d78220f8b5907b875961af9436e229</id>
<content type='text'>
When the device descriptor is closed, the `substream-&gt;runtime` pointer
is freed. But another thread may be in the ioctl handler, case
SNDRV_CTL_IOCTL_PCM_INFO. This case calls snd_pcm_info_user() which
calls snd_pcm_info() which accesses the now freed `substream-&gt;runtime`.

Note: this fixes CVE-2017-0861

Signed-off-by: Robb Glasser &lt;rglasser@google.com&gt;
Signed-off-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Forcibly stop at disconnect callback</title>
<updated>2017-10-18T06:05:46+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2017-10-11T09:42:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6ca73de7ebc5dac358551633e0c69ab6b5007baa'/>
<id>urn:sha1:6ca73de7ebc5dac358551633e0c69ab6b5007baa</id>
<content type='text'>
So far we assumed that each driver implements the hotplug PCM handling
properly, e.g. dealing with the pending PCM stream at disconnect
callback.  But most codes don't care, and it eventually leaves the PCM
stream inconsistent state when an abrupt disconnection like sysfs
unbind happens.

This patch is simple but a big-hammer solution: invoke snd_pcm_stop()
at the common PCM disconnect callback always when the stream is
running.

Tested-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Don't call register and disconnect callbacks for internal PCM</title>
<updated>2017-10-18T06:05:34+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2017-10-17T09:40:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8b645e4a40dd490b9426670fffe9bb9e2878c3fd'/>
<id>urn:sha1:8b645e4a40dd490b9426670fffe9bb9e2878c3fd</id>
<content type='text'>
The internal PCM (aka DPCM backend PCM) doesn't need any registration
procedure, thus currently we bail out immediately at dev_register
callback.  Similarly, its counterpart, dev_disconnect callback, is
superfluous for the internal PCM.  For simplifying and avoiding the
conflicting disconnect call for internal PCM objects, this patch drops
dev_register and dev_disconnect callbacks for the internal ops.

The only uncertain thing by this action is whether skipping the PCM
state change to SNDRV_PCM_STATE_DISCONNECT for the internal PCM is
mandatory.  Looking through the current implementations, this doesn't
look so, hence dropping the whole dev_disconnect would make more
sense.

Tested-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Correct broken procfs set up</title>
<updated>2017-08-24T22:05:16+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2017-08-24T20:11:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e6b4c525d94e6fb28d5c4b9eb4016caa12f68841'/>
<id>urn:sha1:e6b4c525d94e6fb28d5c4b9eb4016caa12f68841</id>
<content type='text'>
The commit c8da9be4a75f ("ALSA: pcm: Adjust nine function calls
together with a variable assignment") contained a badly incorrect
conversion, a "status" PCM procfs creation was replaced with the next
one.  Luckily, this could be spotted easily by the kernel runtime
warning.

Fixes: c8da9be4a75f ("ALSA: pcm: Adjust nine function calls together...")
Reported-by: Fabio Estevam &lt;fabio.estevam@nxp.com&gt;
Tested-by: Fabio Estevam &lt;fabio.estevam@nxp.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Adjust nine function calls together with a variable assignment</title>
<updated>2017-08-23T08:36:18+00:00</updated>
<author>
<name>Markus Elfring</name>
<email>elfring@users.sourceforge.net</email>
</author>
<published>2017-08-23T07:20:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c8da9be4a75f1f63024a16b976c5be47405c13dc'/>
<id>urn:sha1:c8da9be4a75f1f63024a16b976c5be47405c13dc</id>
<content type='text'>
The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring &lt;elfring@users.sourceforge.net&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Use common error handling code in _snd_pcm_new()</title>
<updated>2017-08-23T08:35:50+00:00</updated>
<author>
<name>Markus Elfring</name>
<email>elfring@users.sourceforge.net</email>
</author>
<published>2017-08-23T06:40:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=97d15a141f84a02d40d2ee442df5c6bd2f62b3d8'/>
<id>urn:sha1:97d15a141f84a02d40d2ee442df5c6bd2f62b3d8</id>
<content type='text'>
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring &lt;elfring@users.sourceforge.net&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: constify attribute_group structures.</title>
<updated>2017-06-29T16:20:15+00:00</updated>
<author>
<name>Arvind Yadav</name>
<email>arvind.yadav.cs@gmail.com</email>
</author>
<published>2017-06-29T10:32:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=343fe850668cc38ba0524aa5880b041b2567ae5c'/>
<id>urn:sha1:343fe850668cc38ba0524aa5880b041b2567ae5c</id>
<content type='text'>
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by &lt;linux/device.h&gt; work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   9781	    240	      8	  10029	   272d	sound/core/pcm.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   9813	    176	      8	   9997	   270d	sound/core/pcm.o

Signed-off-by: Arvind Yadav &lt;arvind.yadav.cs@gmail.com&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: add local header file for snd-pcm module</title>
<updated>2017-05-26T06:38:14+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2017-05-26T00:30:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c4842d3b6b3cf6db0f21e487da7e9bd3aa23090'/>
<id>urn:sha1:2c4842d3b6b3cf6db0f21e487da7e9bd3aa23090</id>
<content type='text'>
Several files are used to construct PCM core module, a.k.a snd-pcm.
Although available APIs are described in 'include/sound/pcm.h', some of
them are not exported as symbols in kernel space. Such APIs are just for
module local usage.

This commit adds module local header file and move some function prototypes
into it so that scopes of them are controlled properly and developers
get no confusion from unavailable symbols.

Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: use "do {} while (0)" for empty macro</title>
<updated>2017-05-18T14:38:49+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2017-05-18T13:35:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9aee03f39c13fc674f5973baa69d13e32b45b535'/>
<id>urn:sha1:9aee03f39c13fc674f5973baa69d13e32b45b535</id>
<content type='text'>
Recent compilers produce a harmless warning for the new pcm_call_notify()
macro when CONFIG_SND_PCM_OSS is disabled:

sound/core/pcm.c: In function 'snd_pcm_free':
sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

This turns the empty macro into a 'do {} while (0)' statement to avoid
the warning.

Fixes: 58f30d650c7f ("ALSA: pcm: Build pcm notifier code conditionally")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
</feed>
