linux-stable/sound/core
Takashi Iwai 53466ebdec ALSA: memalloc: Workaround for Xen PV
We change recently the memalloc helper to use
dma_alloc_noncontiguous() and the fallback to get_pages().  Although
lots of issues with IOMMU (or non-IOMMU) have been addressed, but
there seems still a regression on Xen PV.  Interestingly, the only
proper way to work is use dma_alloc_coherent().  The use of
dma_alloc_coherent() for SG buffer was dropped as it's problematic on
IOMMU systems.  OTOH, Xen PV has a different way, and it's fine to use
the dma_alloc_coherent().

This patch is a workaround for Xen PV.  It consists of the following
changes:
- For Xen PV, use only the fallback allocation without
  dma_alloc_noncontiguous()
- In the fallback allocation, use dma_alloc_coherent();
  the DMA address from dma_alloc_coherent() is returned in get_addr
  ops
- The DMA addresses are stored in an array; the first entry stores the
  number of allocated pages in lower bits, which are referred at
  releasing pages again

Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Fixes: a8d302a0b7 ("ALSA: memalloc: Revive x86-specific WC page allocations again")
Fixes: 9736a32513 ("ALSA: memalloc: Don't fall back for SG-buffer with IOMMU")
Link: https://lore.kernel.org/r/87tu256lqs.wl-tiwai@suse.de
Link: https://lore.kernel.org/r/20230125153104.5527-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-27 09:16:24 +01:00
..
oss ALSA: pcm: Avoid reference to status->state 2022-09-27 08:44:05 +02:00
seq ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event 2022-11-19 09:20:11 +01:00
Kconfig ALSA: control: Add input validation 2022-06-15 07:45:28 +02:00
Makefile m68k: coldfire: drop ISA_DMA_API support 2022-05-16 13:18:30 +10:00
compress_offload.c ALSA: compress: Fix kernel doc warnings 2022-07-13 13:42:36 +02:00
control.c ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF 2023-01-13 14:15:26 +01:00
control_compat.c x86: Remove toolchain check for X32 ABI capability 2022-03-15 10:32:48 +01:00
control_led.c ALSA: control-led: use strscpy in set_led_id() 2023-01-09 17:03:24 +01:00
ctljack.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
device.c ALSA: core: Fix missing return value comments for kernel docs 2022-07-13 13:42:38 +02:00
hrtimer.c ALSA: timer: Replace tasklet with work 2020-09-09 18:32:52 +02:00
hwdep.c ALSA: core: Fix assignment in if condition 2021-06-09 17:30:22 +02:00
hwdep_compat.c ALSA: compat_ioctl: avoid compat_alloc_user_space 2020-09-21 10:37:07 +02:00
info.c ALSA: info: Fix llseek return value when using callback 2022-08-17 15:13:30 +02:00
info_oss.c ALSA: oss: remove useless NULL check before kfree 2021-12-06 10:08:13 +01:00
init.c ALSA: core: Fix double-free at snd_card_new() 2022-09-19 14:36:06 +02:00
isadma.c sound updates for 6.0-rc1 2022-08-06 10:19:51 -07:00
jack.c ALSA: jack: Access input_dev under mutex 2022-04-12 12:19:05 +02:00
memalloc.c ALSA: memalloc: Workaround for Xen PV 2023-01-27 09:16:24 +01:00
memalloc_local.h ALSA: memalloc: remove snd_dma_sg_ops declaration 2022-09-09 09:09:40 +02:00
memory.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
misc.c ALSA: core: Add async signal helpers 2022-07-29 12:57:10 +02:00
pcm.c ALSA: pcm: Avoid reference to status->state 2022-09-27 08:44:05 +02:00
pcm_compat.c ALSA: pcm: Avoid reference to status->state 2022-09-27 08:44:05 +02:00
pcm_dmaengine.c ALSA: dmaengine: increment buffer pointer atomically 2022-09-27 08:55:05 +02:00
pcm_drm_eld.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pcm_iec958.c ALSA: iec958: Split status creation and fill 2021-06-08 17:05:41 +02:00
pcm_lib.c ALSA: pcm: Avoid reference to status->state 2022-09-27 08:44:05 +02:00
pcm_local.h ALSA: memalloc: Support for non-contiguous page allocation 2021-10-18 13:32:10 +02:00
pcm_memory.c ALSA: pcm: Fix missing return value comments for kernel docs 2022-07-13 13:42:34 +02:00
pcm_misc.c ALSA: pcm: Test for "silence" field in struct "pcm_format_data" 2022-04-11 09:27:56 +02:00
pcm_native.c ALSA: pcm: Handle XRUN at trigger START 2022-12-05 14:22:48 +01:00
pcm_param_trace.h
pcm_timer.c ALSA: timer: Constify snd_timer_hardware definitions 2020-01-03 09:24:07 +01:00
pcm_trace.h ALSA: pcm: fix tracing reason in hw_ptr_error 2022-11-28 14:55:41 +01:00
rawmidi.c ALSA: rawmidi: remove variable dest_frames 2022-10-24 16:01:05 +02:00
rawmidi_compat.c ALSA: rawmidi: Add framing mode 2021-05-17 16:02:44 +02:00
seq_device.c ALSA: seq: Fix a potential UAF by wrong private_free call order 2021-09-30 14:13:22 +02:00
sound.c ALSA: core: Fix assignment in if condition 2021-06-09 17:30:22 +02:00
sound_oss.c ALSA: oss: Fix potential deadlock at unregistration 2022-10-11 09:02:43 +02:00
timer.c ALSA: timer: Use deferred fasync helper 2022-07-29 12:57:11 +02:00
timer_compat.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
vmaster.c ALSA: core: Fix missing return value comments for kernel docs 2022-07-13 13:42:38 +02:00