]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: memalloc: Don't fall back for SG-buffer with IOMMU
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Nov 2022 13:22:16 +0000 (14:22 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 10 Nov 2022 13:23:03 +0000 (14:23 +0100)
commit236e5cf26a73fcb5683da69a246e13153c806698
treef8e1db0661d499b9ea02473688ef19cc8463acb3
parent41fa1c0a6f9df74fd3ba73c8c97acc25612fba39
ALSA: memalloc: Don't fall back for SG-buffer with IOMMU

When the non-contiguous page allocation for SG buffer allocation
fails, the memalloc helper tries to fall back to the old page
allocation methods.  This would, however, result in the bogus page
addresses when IOMMU is enabled.  Usually in such a case, the fallback
allocation should fail as well, but occasionally it succeeds and
hitting a bad access.

The fallback was thought for non-IOMMU case, and as the error from
dma_alloc_noncontiguous() with IOMMU essentially implies a fatal
memory allocation error, we should return the error straightforwardly
without fallback.  This avoids the corner case like the above.

The patch also renames the local variable "dma_ops" with snd_ prefix
for avoiding the name conflict.

Fixes: b04e1237923a ("ALSA: memalloc: Revive x86-specific WC page allocations again")
Reported-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.22.394.2211041541090.3532114@eliteleevi.tm.intel.com
Link: https://lore.kernel.org/r/20221110132216.30605-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/memalloc.c