]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: hda: realtek: Fix race at concurrent COEF updates
authorTakashi Iwai <tiwai@suse.de>
Mon, 31 Jan 2022 07:57:38 +0000 (08:57 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 31 Jan 2022 07:58:50 +0000 (08:58 +0100)
commit68c0a325714606dfd7e9d13db3985f35813e46ab
tree35cf81809f324cd4636dea946bcfc4b7b02ae8ed
parentc559e55940fd2872fd5f83e9817d2e3d628a048c
ALSA: hda: realtek: Fix race at concurrent COEF updates

The COEF access is done with two steps: setting the index then read or
write the data.  When multiple COEF accesses are performed
concurrently, the index and data might be paired unexpectedly.
In most cases, this isn't a big problem as the COEF setup is done at
the initialization, but some dynamic changes like the mute LED may hit
such a race.

For avoiding the racy COEF accesses, this patch introduces a new
mutex coef_mutex to alc_spec, and wrap the COEF accessing functions
with it.

Reported-by: Alexander Sergeyev <sergeev917@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220111195229.a77wrpjclqwrx4bx@localhost.localdomain
Link: https://lore.kernel.org/r/20220131075738.24323-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c