OSDN Git Service

drivers: dma-removed: Don't free prohibited memmap entries
authorShiraz Hashim <shashim@codeaurora.org>
Mon, 11 Apr 2016 11:15:13 +0000 (16:45 +0530)
committerKyle Yan <kyan@codeaurora.org>
Tue, 31 May 2016 22:25:50 +0000 (15:25 -0700)
The mm subsystem access page structs aligned to
pageblock_nr_pages and assumes that these are valid. We
must not free any memmap entries that it may inspect.

CRs-Fixed: 1000343
Change-Id: I73e0402ee72cad8df307ece1134f9e7304125cf6
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
drivers/base/dma-removed.c

index d20a297..4482dea 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *  Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ *  Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
  *  Copyright (C) 2000-2004 Russell King
  *
  * This program is free software; you can redistribute it and/or modify
@@ -134,6 +134,8 @@ static void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
        struct page *start_pg, *end_pg;
        unsigned long pg, pgend;
 
+       start_pfn = ALIGN(start_pfn, pageblock_nr_pages);
+       end_pfn = round_down(end_pfn, pageblock_nr_pages);
        /*
         * Convert start_pfn/end_pfn to a struct page pointer.
         */