]> git.ipfire.org Git - thirdparty/linux.git/commit
ALSA: pcm: Fix unlocked state reads in read/write file ops
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Wed, 10 Jun 2026 11:31:30 +0000 (08:31 -0300)
committerTakashi Iwai <tiwai@suse.de>
Wed, 10 Jun 2026 14:28:48 +0000 (16:28 +0200)
commit7bc02ab446d38d8d56c548abcb974dfd6fade147
tree0040f0eb4b53341d669b06d439306e4907e5638a
parent764e7ed16d2d6a5948a9e8032b2ef7f77678a8ae
ALSA: pcm: Fix unlocked state reads in read/write file ops

The PCM read/write and readv/writev file operations reject streams in
OPEN or DISCONNECTED state before accessing the configured runtime
parameters. However, each operation reads runtime->state without the
PCM stream lock.

PCM state updates are serialized by the stream lock and may occur
concurrently from IRQ context. Use a local predicate based on
snd_pcm_get_state() to take a locked state snapshot for these VFS entry
checks.

This also consolidates the duplicated OPEN and DISCONNECTED tests. The
conditions and returned errors remain unchanged.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260610-alsa-pcm-read-write-state-helper-v1-1-93b7b992db09@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c