Re: [PATCH] mm/memblock: fix overlapping allocation when doubling reserved array

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

 



On Fri, Jun 15, 2012 at 2:09 PM, Greg Pearson <greg.pearson@xxxxxx> wrote:
> The __alloc_memory_core_early() routine will ask memblock for a range
> of memory then try to reserve it. If the reserved region array lacks
> space for the new range, memblock_double_array() is called to allocate
> more space for the array. If memblock is used to allocate memory for
> the new array it can end up using a range that overlaps with the range
> originally allocated in __alloc_memory_core_early(), leading to possible
> data corruption.
>
> @@ -399,7 +401,8 @@ repeat:
>         */
>        if (!insert) {
>                while (type->cnt + nr_new > type->max)
> -                       if (memblock_double_array(type) < 0)
> +                       /* Avoid possible overlap if range is being reserved */
> +                       if (memblock_double_array(type, base) < 0)

should use obase here.

Yinghai

>                                return -ENOMEM;
>                insert = true;
>                goto repeat;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
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]