]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - sound/pci/hda/patch_realtek.c
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)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 10 Feb 2022 14:31:28 +0000 (15:31 +0100)
commit1b35106ed1c2cfe15943fd04875c1c403dd6b8a6
tree47613c6770f80669f21b6d7f56428d08158efad0
parent24f06bb140e926235f1d03da60a40842f1ca93db
ALSA: hda: realtek: Fix race at concurrent COEF updates

BugLink: https://bugs.launchpad.net/bugs/1960516
commit b837a9f5ab3bdfab9233c9f98a6bef717673a3e5 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
sound/pci/hda/patch_realtek.c