Go to file
Takashi Iwai 1f9b52756c ALSA: pcm: Fix races among concurrent hw_params and hw_free calls
commit 92ee3c60ec upstream.

Currently we have neither proper check nor protection against the
concurrent calls of PCM hw_params and hw_free ioctls, which may result
in a UAF.  Since the existing PCM stream lock can't be used for
protecting the whole ioctl operations, we need a new mutex to protect
those racy calls.

This patch introduced a new mutex, runtime->buffer_mutex, and applies
it to both hw_params and hw_free ioctl code paths.  Along with it, the
both functions are slightly modified (the mmap_count check is moved
into the state-check block) for code simplicity.

Reported-by: Hu Jiahui <kirin.say@gmail.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20220322170720.3529-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[OP: backport to 5.4: adjusted context]
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: samuelliao <samuelliao@tencent.com>
2024-06-11 20:41:27 +08:00
Documentation SPI platform driver support for Phytium desktop CPUS 2024-06-11 20:40:56 +08:00
LICENSES LICENSES: Rename other to deprecated 2019-05-03 06:34:32 -06:00
arch ARM64/Kconfig: Add CONFIG_ASYNC_PAGE_LOCKING 2024-06-11 20:41:24 +08:00
block block-map: add __GFP_ZERO flag for alloc_page in function bio_copy_kern 2024-06-11 20:41:13 +08:00
certs ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
crypto ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
dist dist: remove leds from filter out directory 2024-06-11 20:41:06 +08:00
drivers mmc: block: fix read single on recovery logic 2024-06-11 20:41:27 +08:00
fs ext4: drop unnecessary journal handle in delalloc write 2024-06-11 20:41:16 +08:00
include ALSA: pcm: Fix races among concurrent hw_params and hw_free calls 2024-06-11 20:41:27 +08:00
init irqlatency: add irq latency monitor support 2024-06-11 20:40:51 +08:00
ipc ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
kernel Revert 'sched: adaptive default skew_tick value' 2024-06-11 20:41:25 +08:00
lib ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
mm mm/filemap/c: break generic_file_buffered_read up into multiple functions 2024-06-11 20:41:22 +08:00
net net/proc: added sockets details statistics 2024-06-11 20:41:14 +08:00
package config/ARM64/performance: Enable CONFIG_ASYNC_PAGE_LOCKING 2024-06-11 20:41:25 +08:00
samples ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
scripts ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
security ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
sound ALSA: pcm: Fix races among concurrent hw_params and hw_free calls 2024-06-11 20:41:27 +08:00
tools ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
usr tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
virt ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
.clang-format clang-format: Update with the latest for_each macro list 2019-08-31 10:00:51 +02:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
.gitignore ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS MAINTAINERS: Remove Simon as Renesas SoC Co-Maintainer 2019-10-10 08:12:51 -07:00
Kbuild kbuild: do not descend to ./Kbuild when cleaning 2019-08-21 21:03:58 +09:00
Kconfig docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
MAINTAINERS Phytium JPEG Encoder driver 2024-06-11 20:41:01 +08:00
Makefile ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00
README.md tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
backport_remove_lists.txt tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
tools_key.pub tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00

README.md

Tencent Linux Kernel 4.0