aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2010-03-01 21:48:52 -0500
committerH. Peter Anvin <hpa@zytor.com>2010-03-02 02:23:02 -0500
commitdce46a04d55d6358d2d4ab44a4946a19f9425fe2 (patch)
tree37436a42293f4a47a1fb989007531123baedefa5
parent81d0d950e5037a26b71e568ff235ff9e998f4ab3 (diff)
early_res: Need to save the allocation name in drop_range_partial()
During free_early_partial(), reserve_early_without_check() could end extending the early_res area from __check_and_double_early_res(); as a result, the location of the name for the current reservation could change. Therefore, we need to save a local copy of the name. [ hpa: rewrote comment and checkin description ] Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <4B8C7C94.7070000@kernel.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--kernel/early_res.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/early_res.c b/kernel/early_res.c
index 9ab11cd84853..3cb2c661bb78 100644
--- a/kernel/early_res.c
+++ b/kernel/early_res.c
@@ -79,9 +79,19 @@ static void __init drop_range_partial(int i, u64 start, u64 end)
79 /* make head segment */ 79 /* make head segment */
80 early_res[i].end = common_start; 80 early_res[i].end = common_start;
81 if (old_end > common_end) { 81 if (old_end > common_end) {
82 char name[15];
83
84 /*
85 * Save a local copy of the name, since the
86 * early_res array could get resized inside
87 * reserve_early_without_check() ->
88 * __check_and_double_early_res(), which would
89 * make the current name pointer invalid.
90 */
91 strncpy(name, early_res[i].name,
92 sizeof(early_res[i].name) - 1);
82 /* add another for left over on tail */ 93 /* add another for left over on tail */
83 reserve_early_without_check(common_end, old_end, 94 reserve_early_without_check(common_end, old_end, name);
84 early_res[i].name);
85 } 95 }
86 return; 96 return;
87 } else { 97 } else {