[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAE9FiQWGSDw7R2gbVYKfL6wmRVivaKhSALqXof1TsjgMNNf1hQ@mail.gmail.com>
Date: Fri, 15 Jun 2012 15:39:13 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Greg Pearson <greg.pearson@...com>
Cc: tj@...nel.org, hpa@...ux.intel.com, akpm@...ux-foundation.org,
shangw@...ux.vnet.ibm.com, mingo@...e.hu, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/memblock: fix overlapping allocation when doubling
reserved array
On Fri, Jun 15, 2012 at 2:09 PM, Greg Pearson <greg.pearson@...com> 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists