mint0x33/sound/core
Clement Lecigne c75e7766ce ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF
[ Note: this is a fix that works around the bug equivalently as the
  two upstream commits:
   1fa4445f9adf ("ALSA: control - introduce snd_ctl_notify_one() helper")
   56b88b50565c ("ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF")
  but in a simpler way to fit with older stable trees -- tiwai ]

Add missing locking in ctl_elem_read_user/ctl_elem_write_user which can be
easily triggered and turned into an use-after-free.

Example code paths with SNDRV_CTL_IOCTL_ELEM_READ:

64-bits:
snd_ctl_ioctl
  snd_ctl_elem_read_user
    [takes controls_rwsem]
    snd_ctl_elem_read [lock properly held, all good]
    [drops controls_rwsem]

32-bits (compat):
snd_ctl_ioctl_compat
  snd_ctl_elem_write_read_compat
    ctl_elem_write_read
      snd_ctl_elem_read [missing lock, not good]

CVE-2023-0266 was assigned for this issue.

Signed-off-by: Clement Lecigne <clecigne@google.com>
Cc: stable@kernel.org # 5.12 and older
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-18 09:26:43 +01:00
..
oss ALSA: oss: fix compile error when OSS_DEBUG is enabled 2022-01-27 09:00:52 +01:00
seq ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event 2022-12-14 11:26:12 +01:00
compress_offload.c ALSA: compress: fix partial_drain completion state 2020-07-22 09:22:17 +02:00
control.c ALSA: ctl: fix error path at adding user-defined element set 2020-11-24 13:05:51 +01:00
control_compat.c ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF 2023-01-18 09:26:43 +01:00
ctljack.c
device.c
hrtimer.c
hwdep.c ALSA: hwdep: fix a left shifting 1 by 31 UB bug 2020-06-03 08:18:01 +02:00
hwdep_compat.c
info.c ALSA: info: Fix llseek return value when using callback 2022-08-25 11:11:31 +02:00
info_oss.c
init.c ALSA: core: remove redundant spin_lock pair in snd_card_disconnect 2021-05-22 10:57:32 +02:00
isadma.c
jack.c ALSA: jack: Access input_dev under mutex 2022-06-14 16:53:44 +02:00
Kconfig
Makefile
memalloc.c ALSA: memalloc: Align buffer allocations in page size 2022-07-29 17:06:51 +02:00
memory.c
misc.c ALSA: core: Add async signal helpers 2022-08-25 11:11:37 +02:00
pcm.c ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock 2022-05-15 19:40:27 +02:00
pcm_compat.c
pcm_dmaengine.c ALSA: dmaengine: increment buffer pointer atomically 2022-10-26 13:17:01 +02:00
pcm_drm_eld.c
pcm_iec958.c
pcm_lib.c ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock 2022-05-15 19:40:27 +02:00
pcm_local.h
pcm_memory.c ALSA: pcm: Fix races among concurrent prealloc proc writes 2022-05-15 19:40:27 +02:00
pcm_misc.c ALSA: pcm: Test for "silence" field in struct "pcm_format_data" 2022-04-20 09:08:32 +02:00
pcm_native.c ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock 2022-05-15 19:40:27 +02:00
pcm_param_trace.h
pcm_timer.c
pcm_trace.h
rawmidi.c ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() 2022-10-26 13:16:55 +02:00
rawmidi_compat.c
seq_device.c ALSA: seq: Fix a potential UAF by wrong private_free call order 2021-10-20 10:42:02 +02:00
sgbuf.c
sound.c
sound_oss.c ALSA: oss: Fix potential deadlock at unregistration 2022-10-26 13:16:55 +02:00
timer.c ALSA: timer: Use deferred fasync helper 2022-08-25 11:11:37 +02:00
timer_compat.c
vmaster.c