Thread (1 message) 1 message, 1 author, 2010-08-03

RE: possible bug in ppc_vm_region_alloc()

From: Yossi Etigin <hidden>
Date: 2010-08-03 06:21:18

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help