* RE: possible bug in ppc_vm_region_alloc()
[not found] <7E95F01E94AB484F83061FCFA35B39F801322D@exil.voltaire.com>
@ 2010-08-03 6:21 ` Yossi Etigin
0 siblings, 0 replies; only message in thread
From: Yossi Etigin @ 2010-08-03 6:21 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Alex Netes
Hello,
(I repost this because looks like the previous was filtered because I
was not subscribed to the list)
We are looking at dma_alloc_coherent(), which uses ppc_vm_region_alloc()
on the coherent region "consistent_head".
It seems to us there is a bug in the function ppc_vm_region_alloc().
The check "if (addr > end)" should be "if (addr >=3D end)"
If for example it is called once when the size is the entire coherent
region, the second time it will allocate a region outside the valid
memory.
It will happen because the list will contain one element (besides the
head) which is equal to the head, and neither condition will cause a
"goto nospc". Then the list iteration will end and the new region will
be allocated right after the valid region.
list_for_each_entry(c, &head->vm_list, vm_list) {
if ((addr + size) < addr)
goto nospc;
if ((addr + size) <=3D c->vm_start)
goto found;
addr =3D c->vm_end;
if (addr > end) <=3D=3D=3D here
goto nospc;
}
--Yossi
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-03 6:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <7E95F01E94AB484F83061FCFA35B39F801322D@exil.voltaire.com>
2010-08-03 6:21 ` possible bug in ppc_vm_region_alloc() Yossi Etigin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox