linux-stable/sound/pci
Giacomo Guiduzzi 7115e8d65b ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec
commit 17aaf01933 upstream.

Tests 72 and 78 for ALSA in kselftest fail due to reading
inconsistent values from some devices on a VirtualBox
Virtual Machine using the snd_intel8x0 driver for the AC'97
Audio Controller device.
Taking for example test number 72, this is what the test reports:
"Surround Playback Volume.0 expected 1 but read 0, is_volatile 0"
"Surround Playback Volume.1 expected 0 but read 1, is_volatile 0"
These errors repeat for each value from 0 to 31.

Taking a look at these error messages it is possible to notice
that the written values are read back swapped.
When the write is performed, these values are initially stored in
an array used to sanity-check them and write them in the pcmreg
array. To write them, the two one-byte values are packed together
in a two-byte variable through bitwise operations: the first
value is shifted left by one byte and the second value is stored in the
right byte through a bitwise OR. When reading the values back,
right shifts are performed to retrieve the previously stored
bytes. These shifts are executed in the wrong order, thus
reporting the values swapped as shown above.

This patch fixes this mistake by reversing the read
operations' order.

Signed-off-by: Giacomo Guiduzzi <guiduzzi.giacomo@gmail.com>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220322200653.15862-1-guiduzzi.giacomo@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-28 08:22:27 +02:00
..
ac97 ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec 2022-03-28 08:22:27 +02:00
ali5451 ALSA: ali5451: constify snd_pcm_ops structures 2017-08-10 17:56:04 +02:00
asihpi ALSA: asihpi: fix iounmap in error handler 2020-10-01 13:12:51 +02:00
au88x0 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aw2 ALSA: aw2: make snd_pcm_hardware const 2017-08-12 23:31:39 +02:00
ca0106 ALSA: ca0106: fix error code handling 2020-09-09 19:03:11 +02:00
cs46xx ALSA: pci: delete repeated words in comments 2020-09-03 11:22:24 +02:00
cs5535audio ALSA: cs5535audio: Fix invalid endian conversion 2018-08-22 07:46:09 +02:00
ctxfi ALSA: ctxfi: Fix out-of-range access 2021-12-08 08:46:47 +01:00
echoaudio ALSA: echoaudio: Fix potential Oops in snd_echo_resume() 2020-08-21 09:48:23 +02:00
emu10k1 ALSA: emu10k1: Fix potential Spectre v1 vulnerabilities 2019-01-09 17:14:46 +01:00
hda ALSA: hda: Fix missing codec probe on Shenker Dock 15 2022-02-23 11:57:34 +01:00
ice1712 ALSA: pci: delete repeated words in comments 2020-09-03 11:22:24 +02:00
korg1212 ALSA: korg1212: make snd_pcm_hardware const 2017-08-12 23:31:42 +02:00
lola ALSA: lola: make snd_pcm_hardware const 2017-08-12 23:31:46 +02:00
lx6464es ALSA: lx6464es: make snd_pcm_hardware const 2017-08-12 23:31:48 +02:00
mixart ALSA: mixart: Fix mutex deadlock 2020-11-24 13:05:52 +01:00
nm256 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
oxygen ALSA: pci: delete repeated words in comments 2020-09-03 11:22:24 +02:00
pcxhr ALSA: pcxhr: make snd_kcontrol_new const 2017-08-16 14:29:07 +02:00
riptide ALSA: riptide: make snd_pcm_hardware const 2017-08-12 23:31:53 +02:00
rme9652 ALSA: rme9652: don't disable if not enabled 2021-05-22 10:57:36 +02:00
trident ALSA: trident: Suppress gcc string warning 2018-12-08 13:03:38 +01:00
vx222 ALSA: vx222: Fix invalid endian conversions 2018-08-22 07:46:09 +02:00
ymfpci ALSA: ymfpci: Use common error handling code in snd_ymfpci_create() 2017-09-07 10:33:28 +02:00
ad1889.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
ad1889.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ak4531_codec.c
als300.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
als4000.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
atiixp.c ALSA: atiixp: constify ac97_pcm structures 2017-08-23 15:53:39 +02:00
atiixp_modem.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
azt3328.c
azt3328.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bt87x.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
cmipci.c ALSA: cmipci: Restore aux vol on suspend/resume 2022-03-28 08:22:27 +02:00
cs4281.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
cs5530.c
ens1370.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
ens1371.c
es1938.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
es1968.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
fm801.c ALSA: fm801: add error handling for snd_ctl_add 2018-08-03 07:50:22 +02:00
intel8x0.c ALSA: intel8x0: constify ac97_pcm structures 2017-08-23 15:53:40 +02:00
intel8x0m.c ALSA: intel8x0m: Register irq handler after register initializations 2019-11-20 17:59:58 +01:00
Kconfig
maestro3.c ALSA: maestro3: Use common error handling code in two functions 2017-09-07 10:23:47 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rme32.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
rme96.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
sis7019.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
sis7019.h
sonicvibes.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
via82xx.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00
via82xx_modem.c ALSA: pci: make snd_pcm_hardware const 2017-08-12 23:31:58 +02:00