<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/sound/pcm.h, branch v7.1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-03-16T17:05:55+00:00</updated>
<entry>
<title>ALSA: pcm: oss: use proper stream lock for runtime-&gt;state access</title>
<updated>2026-03-16T17:05:55+00:00</updated>
<author>
<name>Cen Zhang</name>
<email>zzzccc427@gmail.com</email>
</author>
<published>2026-03-16T08:50:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=032322b44c02f5e8a127d1dca6798f91cc72eb1d'/>
<id>urn:sha1:032322b44c02f5e8a127d1dca6798f91cc72eb1d</id>
<content type='text'>
__snd_pcm_set_state() writes runtime-&gt;state under the PCM stream lock.
However, the OSS I/O functions snd_pcm_oss_write3(), snd_pcm_oss_read3(),
snd_pcm_oss_writev3() and snd_pcm_oss_readv3() read runtime-&gt;state
without holding the stream lock, only holding oss.params_lock (a
different mutex that does not synchronize with the stream lock).

Since __snd_pcm_set_state() is called from IRQ context (e.g.,
snd_pcm_period_elapsed -&gt; snd_pcm_update_state -&gt; __snd_pcm_xrun -&gt;
snd_pcm_stop -&gt; snd_pcm_post_stop) while the OSS read/write paths
run in process context, these are concurrent accesses that constitute
a data race.

Rather than using READ_ONCE()/WRITE_ONCE() barriers, introduce a
snd_pcm_get_state() helper that reads runtime-&gt;state under the stream
lock, matching the locking discipline used elsewhere in the PCM layer.
Also export snd_pcm_set_state() for completeness.

Use snd_pcm_get_state() in all four OSS I/O functions, caching the
result in a local variable where the same snapshot is used for
multiple comparisons to avoid taking the lock repeatedly.

Signed-off-by: Cen Zhang &lt;zzzccc427@gmail.com&gt;
Link: https://patch.msgid.link/20260316085047.2876451-1-zzzccc427@gmail.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Improve the fix for race of buffer access at PCM OSS layer</title>
<updated>2026-01-08T07:07:54+00:00</updated>
<author>
<name>Jaroslav Kysela</name>
<email>perex@perex.cz</email>
</author>
<published>2026-01-07T21:36:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=47c27c9c9c720bc93fdc69605d0ecd9382e99047'/>
<id>urn:sha1:47c27c9c9c720bc93fdc69605d0ecd9382e99047</id>
<content type='text'>
Handle the error code from snd_pcm_buffer_access_lock() in
snd_pcm_runtime_buffer_set_silence() function.

Found by Alexandros Panagiotou &lt;apanagio@redhat.com&gt;

Fixes: 93a81ca06577 ("ALSA: pcm: Fix race of buffer access at PCM OSS layer")
Cc: stable@vger.kernel.org # 6.15
Signed-off-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Link: https://patch.msgid.link/20260107213642.332954-1-perex@perex.cz
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' into for-next</title>
<updated>2025-05-22T18:34:24+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2025-05-22T18:34:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d18bbb7b8a7b21238dd05f7ddb7d90e2a50171bf'/>
<id>urn:sha1:d18bbb7b8a7b21238dd05f7ddb7d90e2a50171bf</id>
<content type='text'>
Sync with the pending 6.15 fixes.

Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Fix race of buffer access at PCM OSS layer</title>
<updated>2025-05-16T08:09:02+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2025-05-16T08:08:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=93a81ca0657758b607c3f4ba889ae806be9beb73'/>
<id>urn:sha1:93a81ca0657758b607c3f4ba889ae806be9beb73</id>
<content type='text'>
The PCM OSS layer tries to clear the buffer with the silence data at
initialization (or reconfiguration) of a stream with the explicit call
of snd_pcm_format_set_silence() with runtime-&gt;dma_area.  But this may
lead to a UAF because the accessed runtime-&gt;dma_area might be freed
concurrently, as it's performed outside the PCM ops.

For avoiding it, move the code into the PCM core and perform it inside
the buffer access lock, so that it won't be changed during the
operation.

Reported-by: syzbot+32d4647f551007595173@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/68164d8e.050a0220.11da1b.0019.GAE@google.com
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://patch.msgid.link/20250516080817.20068-1-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Remove unused snd_pcm_rate_range_to_bits</title>
<updated>2025-05-05T10:36:29+00:00</updated>
<author>
<name>Dr. David Alan Gilbert</name>
<email>linux@treblig.org</email>
</author>
<published>2025-05-02T23:52:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=15b39ced6247666f616e3b0b8eeb42cd4a8a11f2'/>
<id>urn:sha1:15b39ced6247666f616e3b0b8eeb42cd4a8a11f2</id>
<content type='text'>
The last use of snd_pcm_rate_range_to_bits() was removed in 2016 by
commit b6b6e4d670c9 ("ASoC: topology: Fix setting of stream rates, rate_min
and rate_max")

Remove it.

Signed-off-by: Dr. David Alan Gilbert &lt;linux@treblig.org&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://patch.msgid.link/20250502235219.1000429-2-linux@treblig.org
</content>
</entry>
<entry>
<title>ALSA: Align the syntax of iov_iter helpers with standard ones</title>
<updated>2024-12-30T11:50:04+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2024-12-30T11:49:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1b2ff639ff0cb999285d90c57d3f856b91c2aea6'/>
<id>urn:sha1:1b2ff639ff0cb999285d90c57d3f856b91c2aea6</id>
<content type='text'>
We introduced a couple of helpers for copying iomem over iov_iter, and
the functions were formed like the former copy_from/to_user(), and the
return value was adjusted to 0/-EFAULT, which made the code transition
a bit easier at that time.

OTOH, the standard copy_from/to_iter() functions have different
argument orders and the return value, and this difference can be
confusing.  It's not only confusing but dangerous; actually I did
write a wrong code due to that once :-&lt;

For reducing the confusion, this patch changes the syntax of those
helpers to align with the standard copy_from/to_iter().  The argument
order is changed and the return value is the size of copied bytes.
The callers of those functions are updated accordingly, too.

Link: https://patch.msgid.link/20241230114903.4959-1-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Define snd_pcm_mmap_data_{open|close}() locally</title>
<updated>2024-11-13T12:33:28+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2024-11-13T11:16:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f69c2861b05e29c69abed6aafe0cefd224d9d4db'/>
<id>urn:sha1:f69c2861b05e29c69abed6aafe0cefd224d9d4db</id>
<content type='text'>
snd_pcm_mmap_data_open() and _close() are defined as inline functions
in the public sound/pcm.h, but those are used only locally in
pcm_native.c, hence they should be better placed there.

Also, those are referred as callbacks, the useless inline is dropped.

Link: https://patch.msgid.link/20241113111628.17069-1-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: tidyup SNDRV_PCM_TRIGGER_xxx numbering</title>
<updated>2024-11-13T07:23:57+00:00</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2024-11-13T01:17:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8f80f378e77eafdcdb7ea9a76cc645ecd04fb4e5'/>
<id>urn:sha1:8f80f378e77eafdcdb7ea9a76cc645ecd04fb4e5</id>
<content type='text'>
pcm.h has SNDRV_PCM_TRIGGER_xxx, but it is missing "2".
Fixup it.

Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Link: https://patch.msgid.link/87ed3gsziy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: Fix breakage of PCM rates used for topology</title>
<updated>2024-09-11T14:17:44+00:00</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2024-09-11T13:57:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9a26234423b87e111351eac0e95775e6ba14d752'/>
<id>urn:sha1:9a26234423b87e111351eac0e95775e6ba14d752</id>
<content type='text'>
It turned out that the topology ABI takes the standard PCM rate bits
as is, and it means that the recent change of the PCM rate bits would
lead to the inconsistent rate values used for topology.

This patch reverts the original PCM rate bit definitions while adding
the new rates to the extended bits instead.  This needed the change of
snd_pcm_known_rates, too.  And this also required to fix the handling
in snd_pcm_hw_limit_rates() that blindly assumed that the list is
sorted while it became unsorted now.

Fixes: 090624b7dc83 ("ALSA: pcm: add more sample rate definitions")
Reported-by: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Closes: https://lore.kernel.org/1ab3efaa-863c-4dd0-8f81-b50fd9775fad@linux.intel.com
Reviewed-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Tested-by: Jerome Brunet &lt;jbrunet@baylibre.com&gt;
Tested-by: Bard Liao &lt;yung-chuan.liao@linux.intel.com&gt;
Link: https://patch.msgid.link/20240911135756.24434-1-tiwai@suse.de
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: pcm: add more sample rate definitions</title>
<updated>2024-09-06T07:23:54+00:00</updated>
<author>
<name>Jerome Brunet</name>
<email>jbrunet@baylibre.com</email>
</author>
<published>2024-09-05T14:12:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=090624b7dc8389a516df3adb447a25dc0723adfe'/>
<id>urn:sha1:090624b7dc8389a516df3adb447a25dc0723adfe</id>
<content type='text'>
This adds a sample rate definition for 12kHz, 24kHz and 128kHz.

Admittedly, just a few drivers are currently using these sample
rates but there is enough of a recurrence to justify adding a definition
for them and remove some custom rate constraint code while at it.

The new definitions are not added to the interval definitions, such as
SNDRV_PCM_RATE_8000_44100, because it would silently add new supported
rates to drivers that may or may not support them. For sure the drivers
have not been tested for these new rates so it is better to leave them out
of interval definitions.

That being said, the added rates are multiples of well know rates families,
it is very likely that a lot of devices out there actually supports them.

Signed-off-by: Jerome Brunet &lt;jbrunet@baylibre.com&gt;
Reviewed-by: David Rhodes &lt;drhodes@opensource.cirrus.com&gt;
Acked-by: Mark Brown &lt;broonie@kernel.org&gt;
Reviewed-by: Jaroslav Kysela &lt;perex@perex.cz&gt;
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Link: https://patch.msgid.link/20240905-alsa-12-24-128-v1-1-8371948d3921@baylibre.com
</content>
</entry>
</feed>
