diff options
| author | Takashi Iwai <tiwai@suse.de> | 2026-10-07 19:20:38 +0200 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-10-08 08:47:06 +0200 |
| commit | c0a10d0e0e0d35361d2c81e1192db66ba726475d (patch) | |
| tree | be889cc2a195630b38b842504b45b7071485c77c /tools/lib/python/kdoc/python_version.py | |
| parent | 8bd561f8a6051f4e287dd0d076f17a1af5bff009 (diff) | |
ALSA: pcm: Fix TOCTOU state overwrite in snd_pcm_drop()
snd_pcm_drop() checks the current state at the beginning, and bails
out if it's in an invalid state (OPEN or DISCONNECTED). However,
since the check is done before the PCM stream lock, this can lead to a
Time-of-Check to Time-of-Use (TOCTOU) race against the other forcible
state change like the device disconnection like below:
CPU 0 CPU 1
----- -----
snd_pcm_drop()
runtime->state check
snd_pcm_dev_disconnect()
guard(pcm_stream_lock_irq)
runtime->state = SNDRV_PCM_STATE_DISCONNECTED
guard(pcm_stream_lock_irq)
snd_pcm_stop(SNDRV_PCM_STATE_SETUP) <== inconsistent state
For avoiding the inconsistent state change, this patch moves the
runtime state check inside the stream lock guard.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261007172051.13240-3-tiwai@suse.de
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
