From: Meelis Roos <mroos@linux.ee>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@lst.de>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: dma-mapping: Fix arch_dma_alloc_attrs() oops with NULL dev
Date: Sun, 25 Oct 2015 23:46:56 +0200 (EET) [thread overview]
Message-ID: <alpine.LRH.2.20.1510252346080.22875@math.ut.ee> (raw)
In-Reply-To: <1445807503-8920-1-git-send-email-ville.syrjala@linux.intel.com>
> From: Ville Syrjälä <ville.syrjala@linux.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@linux.ee)
next prev parent reply other threads:[~2015-10-25 21:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-25 21:11 ville.syrjala
2015-10-25 21:46 ` Meelis Roos [this message]
2015-10-26 6:03 ` [tip:x86/urgent] x86/dma-mapping: " tip-bot for Ville Syrjälä
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.20.1510252346080.22875@math.ut.ee \
--to=mroos@linux.ee \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®