]> git.baikalelectronics.ru Git - kernel.git/commit
x86/dma-mapping: Fix arch_dma_alloc_attrs() oops with NULL dev
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Sun, 25 Oct 2015 21:11:43 +0000 (23:11 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 26 Oct 2015 05:59:36 +0000 (14:59 +0900)
commit977cd231a5f1cec6ef6316be32fabf6cb7c78b07
tree7fc0663def81b3edfb2bba1871a46fa74519d932
parentee80ff68445d23aeb95aea404e6ca43d90787671
x86/dma-mapping: Fix arch_dma_alloc_attrs() oops with NULL dev

Commit a55248ee605d broke drivers that pass NULL as the device pointer
to dma_alloc. The reason is that arch_dma_alloc_attrs() now calls
dma_alloc_coherent_gfp_flags() which in turn calls
dma_alloc_coherent_mask(), where the device pointer is dereferenced
unconditionally.

Fix things by moving the ISA DMA fallback device assignment before the
call to dma_alloc_coherent_gfp_flags().

Fixes: a55248ee605d ("dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}")
Reported-and-tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/1445807503-8920-1-git-send-email-ville.syrjala@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/pci-dma.c