]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
DMA-API: sound: fix dma mask handling in a lot of drivers
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 27 Jun 2013 11:53:37 +0000 (12:53 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 3 Oct 2013 09:22:45 +0000 (10:22 +0100)
commit4e3f9e5b8e4975fe7d92d9ad92efe1c443d39985
treee2f73839b2be962bd4b4f19279aafa38e7b72332
parent128fae4e021af0e6be147a3c4169a801561d1a26
DMA-API: sound: fix dma mask handling in a lot of drivers

This code sequence is unsafe in modules:

static u64 mask = DMA_BIT_MASK(something);
...
if (!dev->dma_mask)
dev->dma_mask = &mask;

as if a module is reloaded, the mask will be pointing at the original
module's mask address, and this can lead to oopses.  Moreover, they
all follow this with:

if (!dev->coherent_dma_mask)
dev->coherent_dma_mask = mask;

where 'mask' is the same value as the statically defined mask, and this
bypasses the architecture's check on whether the DMA mask is possible.

Fix these issues by using the new dma_coerce_coherent_and_mask()
function.

Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
16 files changed:
sound/arm/pxa2xx-pcm.c
sound/soc/atmel/atmel-pcm.c
sound/soc/blackfin/bf5xx-ac97-pcm.c
sound/soc/blackfin/bf5xx-i2s-pcm.c
sound/soc/davinci/davinci-pcm.c
sound/soc/fsl/fsl_dma.c
sound/soc/fsl/imx-pcm-fiq.c
sound/soc/fsl/mpc5200_dma.c
sound/soc/jz4740/jz4740-pcm.c
sound/soc/kirkwood/kirkwood-dma.c
sound/soc/nuc900/nuc900-pcm.c
sound/soc/omap/omap-pcm.c
sound/soc/pxa/pxa2xx-pcm.c
sound/soc/s6000/s6000-pcm.c
sound/soc/samsung/dma.c
sound/soc/samsung/idma.c