[PATCH 28/51] DMA-API: sound: fix dma mask handling in a lot of drivers
Russell King - ARM Linux
linux at arm.linux.org.uk
Thu Sep 26 03:54:25 EDT 2013
On Thu, Sep 26, 2013 at 09:51:23AM +0200, Takashi Iwai wrote:
> Hi,
>
> sorry for the lat response, as I've been traveling in the last weeks.
>
> At Thu, 19 Sep 2013 22:53:02 +0100,
> Russell King wrote:
> >
> > 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.
> >
> > Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
>
> Applied with Mark's ack now.
Which is a very stupid thing to do because you won't have
dma_coerce_coherent_and_mask() in your tree, so all these drivers
will fail to build for you.
More information about the linux-arm-kernel
mailing list