[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.20.1510252346080.22875@math.ut.ee>
Date: Sun, 25 Oct 2015 23:46:56 +0200 (EET)
From: Meelis Roos <mroos@...ux.ee>
To: Ville Syrjälä <ville.syrjala@...ux.intel.com>
cc: Linux Kernel list <linux-kernel@...r.kernel.org>,
Christoph Hellwig <hch@....de>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] x86: dma-mapping: Fix arch_dma_alloc_attrs() oops with
NULL dev
> From: Ville Syrjälä <ville.syrjala@...ux.intel.com>
>
> Commit 6894258eda2f ("dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}")
> broke drivers that pass NULL as the device for dma_alloc.
> Fix things by moving the ISA DMA fallback dev assignment earlier.
>
> A quick search suggest that Meelis Roos has hit this with sb16, and I
> caught it with smsc-ircc2. Here's the oops I got:
[...]
The patch also fixes my SB16 issue, thank you!
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index 1b55de1..cd99433 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -131,11 +131,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void *vaddr,
>
> bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp)
> {
> + if (!*dev)
> + *dev = &x86_dma_fallback_dev;
> +
> *gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
> *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp);
>
> - if (!*dev)
> - *dev = &x86_dma_fallback_dev;
> if (!is_device_dma_capable(*dev))
> return false;
> return true;
>
--
Meelis Roos (mroos@...ux.ee)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists