mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michal Nazarewicz" <mina86@mina86.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org,
	"Marek Szyprowski" <m.szyprowski@samsung.com>
Cc: "Kyungmin Park" <kyungmin.park@samsung.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Konrad Rzeszutek Wilk" <konrad@darnok.org>,
	"Arnd Bergmann" <arnd@arndb.de>
Subject: Re: [PATCH] x86: dma-mapping: fix broken allocation when dma_mask has been provided
Date: Wed, 13 Jun 2012 09:56:05 +0200	[thread overview]
Message-ID: <op.wft0brk93l0zgt@mpn-glaptop> (raw)
In-Reply-To: <1339567046-2264-1-git-send-email-m.szyprowski@samsung.com>

On Wed, 13 Jun 2012 07:57:26 +0200, Marek Szyprowski <m.szyprowski@samsung.com> wrote:

> Commit 0a2b9a6ea93 ("X86: integrate CMA with DMA-mapping subsystem")
> broke memory allocation with dma_mask. This patch fixes possible kernel
> ops caused by lack of resetting page variable when jumping to 'again' label.
>
> Reported-by: Konrad Rzeszutek Wilk <konrad@darnok.org>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  arch/x86/kernel/pci-dma.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index 62c9457..c0f420f 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -100,7 +100,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
>  				 struct dma_attrs *attrs)
>  {
>  	unsigned long dma_mask;
> -	struct page *page = NULL;
> +	struct page *page;
>  	unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
>  	dma_addr_t addr;
>@@ -108,6 +108,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
> 	flag |= __GFP_ZERO;
>  again:
> +	page = NULL;
>  	if (!(flag & GFP_ATOMIC))
>  		page = dma_alloc_from_contiguous(dev, count, get_order(size));
>  	if (!page)


-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

      reply	other threads:[~2012-06-13  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13  5:57 Marek Szyprowski
2012-06-13  7:56 ` Michal Nazarewicz [this message]

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=op.wft0brk93l0zgt@mpn-glaptop \
    --to=mina86@mina86.com \
    --cc=arnd@arndb.de \
    --cc=konrad@darnok.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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®