<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/sound/core/oss, branch linux-4.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.1.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.1.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-05-23T01:36:34Z</updated>
<entry>
<title>ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation</title>
<updated>2018-05-23T01:36:34Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-04-07T09:48:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6dab42d43597e2b204bfc3c557931e3c4e4e11bd'/>
<id>urn:sha1:6dab42d43597e2b204bfc3c557931e3c4e4e11bd</id>
<content type='text'>
[ Upstream commit e15dc99dbb9cf99f6432e8e3c0b3a8f7a3403a86 ]

The commit 02a5d6925cd3 ("ALSA: pcm: Avoid potential races between OSS
ioctls and read/write") split the PCM preparation code to a locked
version, and it added a sanity check of runtime-&gt;oss.prepare flag
along with the change.  This leaded to an endless loop when the stream
gets XRUN: namely, snd_pcm_oss_write3() and co call
snd_pcm_oss_prepare() without setting runtime-&gt;oss.prepare flag and
the loop continues until the PCM state reaches to another one.

As the function is supposed to execute the preparation
unconditionally, drop the invalid state check there.

The bug was triggered by syzkaller.

Fixes: 02a5d6925cd3 ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write")
Reported-by: syzbot+150189c103427d31a053@syzkaller.appspotmail.com
Reported-by: syzbot+7e3f31a52646f939c052@syzkaller.appspotmail.com
Reported-by: syzbot+4f2016cf5185da7759dc@syzkaller.appspotmail.com
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Fix mutex unbalance in OSS emulation ioctls</title>
<updated>2018-05-23T01:36:34Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-03-27T12:32:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e9650576c4414657d21d3e20b1bbfd03aae1d758'/>
<id>urn:sha1:e9650576c4414657d21d3e20b1bbfd03aae1d758</id>
<content type='text'>
[ Upstream commit f6d297df4dd47ef949540e4a201230d0c5308325 ]

The previous fix 40cab6e88cb0 ("ALSA: pcm: Return -EBUSY for OSS
ioctls changing busy streams") introduced some mutex unbalance; the
check of runtime-&gt;oss.rw_ref was inserted in a wrong place after the
mutex lock.

This patch fixes the inconsistency by rewriting with the helper
functions to lock/unlock parameters with the stream check.

Fixes: 40cab6e88cb0 ("ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams")
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams</title>
<updated>2018-05-23T01:36:34Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-03-23T07:03:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=151fafd90c4390c42c6414ecea21bb612692c5e1'/>
<id>urn:sha1:151fafd90c4390c42c6414ecea21bb612692c5e1</id>
<content type='text'>
[ Upstream commit 40cab6e88cb0b6c56d3f30b7491a20e803f948f6 ]

OSS PCM stream management isn't modal but it allows ioctls issued at
any time for changing the parameters.  In the previous hardening
patch ("ALSA: pcm: Avoid potential races between OSS ioctls and
read/write"), we covered these races and prevent the corruption by
protecting the concurrent accesses via params_lock mutex.  However,
this means that some ioctls that try to change the stream parameter
(e.g. channels or format) would be blocked until the read/write
finishes, and it may take really long.

Basically changing the parameter while reading/writing is an invalid
operation, hence it's even more user-friendly from the API POV if it
returns -EBUSY in such a situation.

This patch adds such checks in the relevant ioctls with the addition
of read/write access refcount.

Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Avoid potential races between OSS ioctls and read/write</title>
<updated>2018-05-23T01:36:34Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-03-22T17:10:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6a12e6f4dd07fc1a894798fca352f7fdae122eb'/>
<id>urn:sha1:d6a12e6f4dd07fc1a894798fca352f7fdae122eb</id>
<content type='text'>
[ Upstream commit 02a5d6925cd34c3b774bdb8eefb057c40a30e870 ]

Although we apply the params_lock mutex to the whole read and write
operations as well as snd_pcm_oss_change_params(), we may still face
some races.

First off, the params_lock is taken inside the read and write loop.
This is intentional for avoiding the too long locking, but it allows
the in-between parameter change, which might lead to invalid
pointers.  We check the readiness of the stream and set up via
snd_pcm_oss_make_ready() at the beginning of read and write, but it's
called only once, by assuming that it remains ready in the rest.

Second, many ioctls that may change the actual parameters
(i.e. setting runtime-&gt;oss.params=1) aren't protected, hence they can
be processed in a half-baked state.

This patch is an attempt to plug these holes.  The stream readiness
check is moved inside the read/write inner loop, so that the stream is
always set up in a proper state before further processing.  Also, each
ioctl that may change the parameter is wrapped with the params_lock
for avoiding the races.

The issues were triggered by syzkaller in a few different scenarios,
particularly the one below appearing as GPF in loopback_pos_update.

Reported-by: syzbot+c4227aec125487ec3efa@syzkaller.appspotmail.com
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Use ERESTARTSYS instead of EINTR in OSS emulation</title>
<updated>2018-05-23T01:36:34Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-01-09T07:51:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=596e639d60c2f685fc2765efa9de4ababcc353f5'/>
<id>urn:sha1:596e639d60c2f685fc2765efa9de4ababcc353f5</id>
<content type='text'>
[ Upstream commit c64ed5dd9feba193c76eb460b451225ac2a0d87b ]

Fix the last standing EINTR in the whole subsystem.  Use more correct
ERESTARTSYS for pending signals.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: oss: consolidate kmalloc/memset 0 call to kzalloc</title>
<updated>2018-05-23T01:36:34Z</updated>
<author>
<name>Nicholas Mc Guire</name>
</author>
<published>2015-12-19T14:23:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9ef1bdb4d645d4778e36ad85ce66f2e1d6b8c06a'/>
<id>urn:sha1:9ef1bdb4d645d4778e36ad85ce66f2e1d6b8c06a</id>
<content type='text'>
[ Upstream commit 46325371b230cc66c743925c930a17e7d0b8211e ]

This is an API consolidation only. The use of kmalloc + memset to 0
is equivalent to kzalloc.

Signed-off-by: Nicholas Mc Guire &lt;hofrat@osadl.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Fix UAF in snd_pcm_oss_get_formats()</title>
<updated>2018-05-23T01:33:47Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-03-10T22:04:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2cd1008f21bd10b1b6cbae3fc51e03e9e4aa9c36'/>
<id>urn:sha1:2cd1008f21bd10b1b6cbae3fc51e03e9e4aa9c36</id>
<content type='text'>
[ Upstream commit 01c0b4265cc16bc1f43f475c5944c55c10d5768f ]

snd_pcm_oss_get_formats() has an obvious use-after-free around
snd_mask_test() calls, as spotted by syzbot.  The passed format_mask
argument is a pointer to the hw_params object that is freed before the
loop.  What a surprise that it has been present since the original
code of decades ago...

Reported-by: syzbot+4090700a4f13fccaf648@syzkaller.appspotmail.com
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Allow aborting mutex lock at OSS read/write loops</title>
<updated>2018-03-01T00:32:22Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-01-08T13:03:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=88e649cefa6ade1418b69c519156756310bfae8a'/>
<id>urn:sha1:88e649cefa6ade1418b69c519156756310bfae8a</id>
<content type='text'>
[ Upstream commit 900498a34a3ac9c611e9b425094c8106bdd7dc1c ]

PCM OSS read/write loops keep taking the mutex lock for the whole
read/write, and this might take very long when the exceptionally high
amount of data is given.  Also, since it invokes with mutex_lock(),
the concurrent read/write becomes unbreakable.

This patch tries to address these issues by replacing mutex_lock()
with mutex_lock_interruptible(), and also splits / re-takes the lock
at each read/write period chunk, so that it can switch the context
more finely if requested.

Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Abort properly at pending signal in OSS read/write loops</title>
<updated>2018-03-01T00:32:22Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-01-08T12:58:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d8f605888a2dc72bfcb2f30b2412f0bf1e2e1c05'/>
<id>urn:sha1:d8f605888a2dc72bfcb2f30b2412f0bf1e2e1c05</id>
<content type='text'>
[ Upstream commit 29159a4ed7044c52e3e2cf1a9fb55cec4745c60b ]

The loops for read and write in PCM OSS emulation have no proper check
of pending signals, and they keep processing even after user tries to
break.  This results in a very long delay, often seen as RCU stall
when a huge unprocessed bytes remain queued.  The bug could be easily
triggered by syzkaller.

As a simple workaround, this patch adds the proper check of pending
signals and aborts the loop appropriately.

Reported-by: syzbot+993cb4cfcbbff3947c21@syzkaller.appspotmail.com
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Add missing error checks in OSS emulation plugin builder</title>
<updated>2018-03-01T00:32:22Z</updated>
<author>
<name>Takashi Iwai</name>
</author>
<published>2018-01-04T15:39:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3f30e73b418526585d99309fd02b5b56307cb83d'/>
<id>urn:sha1:3f30e73b418526585d99309fd02b5b56307cb83d</id>
<content type='text'>
[ Upstream commit 6708913750344a900f2e73bfe4a4d6dbbce4fe8d ]

In the OSS emulation plugin builder where the frame size is parsed in
the plugin chain, some places miss the possible errors returned from
the plugin src_ or dst_frames callback.

This patch papers over such places.

Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
</feed>
