mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <lg@denx.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, lethal@linux-sh.org,
	adrian@newgolddream.dyndns.info, lkmladrian@gmail.com,
	linux-sh@vger.kernel.org, penberg@cs.helsinki.fi,
	dbaryshkov@gmail.com, penguin-kernel@i-love.sakura.ne.jp,
	hannes@cmpxchg.org
Subject: Re: [PATCH] fix broken size test in bitmap_find_free_region()
Date: Fri, 6 Feb 2009 23:30:56 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0902062328300.7686@axis700.grange> (raw)
In-Reply-To: <20090206132950.96c3f92e.akpm@linux-foundation.org>

On Fri, 6 Feb 2009, Andrew Morton wrote:

> On Fri, 6 Feb 2009 13:22:33 +0100 (CET)
> Guennadi Liakhovetski <lg@denx.de> wrote:
> 
> > This loop and test in bitmap_find_free_region()
> > 
> > 	for (pos = 0; pos < bits; pos += (1 << order))
> > 		if (__reg_op(bitmap, pos, order, REG_OP_ISFREE))
> > 			break;
> > 	if (pos == bits)
> > 		return -ENOMEM;
> > 
> > can only return an error (-ENOMEM) if bits is a multiple of (1 << order), 
> > which is, for instance, true, if bits is (also) a power of 2. This 
> > is not necessarily the case with dma_alloc_from_coherent(). A failure to 
> > recognise too large a request leads in dma_alloc_from_coherent() to 
> > accessing beyond available memory, and to writing beyond the bitmap.
> > 
> 
> Do we have any reports of dma_alloc_from_coherent() actually behaving
> in that way?

Does this count:

http://marc.info/?l=linux-kernel&m=123313185800954&w=2

Yes, I did see this behaviour with a video driver, that's still not in the 
mainline (expected in the next cycle), using videobuf-dma-contig.c in the 
__videobuf_mmap_mapper() function.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de

      reply	other threads:[~2009-02-06 22:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 21:48 [PATCH] dma: fix up broken comparison in dma_alloc_from_coherent Adrian McMenamin
2009-01-20 21:55 ` Adrian McMenamin
2009-01-21  3:39   ` Paul Mundt
2009-01-21  8:11     ` Paul Mundt
2009-01-21  8:29       ` Guennadi Liakhovetski
2009-01-21  8:30         ` Paul Mundt
2009-01-27 21:48       ` Andrew Morton
2009-01-27 22:54         ` Paul Mundt
2009-01-28  8:36           ` Guennadi Liakhovetski
2009-02-06 12:22             ` [PATCH] fix broken size test in bitmap_find_free_region() Guennadi Liakhovetski
2009-02-06 21:29               ` Andrew Morton
2009-02-06 22:30                 ` Guennadi Liakhovetski [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=Pine.LNX.4.64.0902062328300.7686@axis700.grange \
    --to=lg@denx.de \
    --cc=adrian@newgolddream.dyndns.info \
    --cc=akpm@linux-foundation.org \
    --cc=dbaryshkov@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=lkmladrian@gmail.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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®