Re: [PATCH] mm: nommu: fix remap_pfn_range()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 28, 2011 at 6:09 AM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 27 May 2011 11:50:03 +0800
> Bob Liu <lliubbo@xxxxxxxxx> wrote:
>
>> remap_pfn_range() does not update vma->end on no mmu arch which will
>> cause munmap() fail because it can't match the vma.
>>
>> eg. fb_mmap() in fbmem.c will call io_remap_pfn_range() which is
>> remap_pfn_range() on nommu arch, if an address is not page aligned vma->start
>> will be changed in remap_pfn_range(), but neither size nor vma->end will be
>> updated. Then munmap(start, len) can't find the vma to free, because it need to
>> compare (start + len) with vma->end.
>>
>> Signed-off-by: Bob Liu <lliubbo@xxxxxxxxx>
>> ---
>> Âmm/nommu.c | Â Â1 +
>> Â1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/mm/nommu.c b/mm/nommu.c
>> index 1fd0c51..829848a 100644
>> --- a/mm/nommu.c
>> +++ b/mm/nommu.c
>> @@ -1817,6 +1817,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
>> Â Â Â Â Â Â Â unsigned long to, unsigned long size, pgprot_t prot)
>> Â{
>> Â Â Â vma->vm_start = vma->vm_pgoff << PAGE_SHIFT;
>> + Â Â vma->vm_end = vma->vm_start + size;
>> Â Â Â return 0;
>> Â}
>> ÂEXPORT_SYMBOL(remap_pfn_range);
>
> hm.
>
> The MMU version of remap_pfn_range() doesn't do this. ÂSeems that it
> just leaves the omitted parts of the vma unmapped. ÂObviously nommu
> can't do that, but the divergence is always a concern.
>
> Thsi implementation could lead to overlapping vmas. ÂShould we be
> checking that it fits?
>

Hi, Andrew

Sorry for the late response and thanks for your review.
I think the overlapping vmas could exist whether this patch or not.
Maybe extra check is needed but since nobody run into that cases,
could we check it in future patches?

Thanks
-- 
Regards,
--Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]