mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ajeet Yadav <ajeet.yadav.77@gmail.com>
Cc: Jon Medhurst <tixy@yxit.co.uk>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Sumit Bhattacharya <sumitb@nvidia.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Naveen Yadav <yad.naveen@gmail.com>
Subject: Re: [PATCH 3/3] ARM: dma-mapping: fix array out of bound access
Date: Fri, 17 Feb 2012 17:19:15 +0000	[thread overview]
Message-ID: <20120217171915.GO27825@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1329494160-26942-1-git-send-email-ajeet.yadav.77@gmail.com>

On Fri, Feb 17, 2012 at 09:26:00PM +0530, Ajeet Yadav wrote:
> In __dma_alloc_remap(*,size,*,*)/ __dma_free_remap(*,size) functions
> if virtual address is in the last consistent mapping region
> i.e idx == ((CONSISTENT_END - base) >> PMD_SHIFT) - 1
> and off == PTRS_PER_PTE.
> then we have array out of bound access condition.

How?  Where?

At the first loop, off will _never_ be PTRS_PER_PTE.

                u32 off = CONSISTENT_OFFSET(c->vm_start) & (PTRS_PER_PTE-1);

There is _absolutely_ _no_ _way_ that off could ever be PTRS_PER_PTE
here.

If 'base' is CONSISTENT_END, then we have far bigger problems, because
it means that we have a zero sized region - it certainly can't be any
larger than zero size because then we'd be overflowing the DMA region
into something else.

Plus, we know that 'end of region' allocations work fine, because the
code allocates from the top of the region downwards.

So, I don't think there's a problem here.

  reply	other threads:[~2012-02-17 17:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 15:56 Ajeet Yadav
2012-02-17 17:19 ` Russell King - ARM Linux [this message]
     [not found]   ` <CAB4K4y65c+UdPMpZNSKKhz3fQO1C6no5SnMAsirQ3LvrAk3gpA@mail.gmail.com>
2012-02-17 17:51     ` Russell King - ARM Linux
     [not found]   ` <CAB4K4y7maT1ZQSPKXq6SAng+8fXOFV1kyzVC7AiJGCmgMu5MDg@mail.gmail.com>
2012-02-22 11:21     ` Ajeet Yadav

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=20120217171915.GO27825@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=ajeet.yadav.77@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=sumitb@nvidia.com \
    --cc=tixy@yxit.co.uk \
    --cc=yad.naveen@gmail.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®