a bug report for function move_freepages_block

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

 



HI all,
I think there is a bug in function move_freepages_block.

 981 int move_freepages_block(struct zone *zone, struct page *page,
...
 987         start_pfn = page_to_pfn(page);
 988         start_pfn = start_pfn & ~(pageblock_nr_pages-1);
 989         start_page = pfn_to_page(start_pfn);
 990         end_page = start_page + pageblock_nr_pages - 1;
 991         end_pfn = start_pfn + pageblock_nr_pages - 1;
 992 
 993         /* Do not cross zone boundaries */
 994         if (!zone_spans_pfn(zone, start_pfn))
 995                 start_page = page;

The line 988 will align start_pfn with pageblock_nr_pages,
thus after line988, start_pfn maybe less than zone->pageblock_nr_pages,
in the worst case, start_pfn maybe outof the range of zone->node pfn.
and becomes a invalid pfn.
in this case, line 989 will be wrong.

so I think the check for start_pfn should be done before line 989, just like:
    start_pfn = start_pfn & ~(pageblock_nr_pages-1); <== line 988
    if (!zone_spans_pfn(zone, start_pfn))
    start_pfn = page_to_pfn(page);

Regards,
Martin

[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]