- makedumpfile-fix-free-bitmap_buffer_cyclic.patch: Fix free

bitmap_buffer_cyclic error.

OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/makedumpfile?expand=0&rev=86
This commit is contained in:
Petr Tesařík
2014-06-16 07:49:45 +00:00
committed by Git OBS Bridge
parent 1032a7c464
commit e11b1e1505
3 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
From: Arthur Zou <zzou@redhat.com>
Date: Wed May 7 17:54:16 2014 +0900
Subject: Fix free bitmap_buffer_cyclic error.
Patch-mainline: v1.5.7
Git-commit: 0e7b1a6e3c1919c9222b662d458637ddf802dd04
Description:
In create_dump_bitmap() and write_kdump_pages_and_bitmap_cyclic(),
What should be freed is info->partial_bitmap instead of info->bitmap.
Solution:
Add two functions to free the bitmap_buffer_cyclic. info->partial_bitmap1
is freed by free_bitmap1_buffer_cyclic(). info->partial_bitmap2 is
freed by free_bitmap2_buffer_cyclic(). At the same time, remove
thoes frees that free partial_bitmap1 or partial_bitmap2 at the end
of main() because partial_bitmap1 and partial_bitmap2 has been freed
after dump file has been written out, so there is no need to free it
again at the end of main.
Signed-off-by: Arthur Zou <zzou@redhat.com>
Acked-by: Petr Tesarik <ptesarik@suse.cz>
diff --git a/makedumpfile.c b/makedumpfile.c
index 16081a5..ef8a750 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5130,6 +5130,31 @@ free_bitmap_buffer(void)
free_bitmap2_buffer();
}
+void
+free_bitmap1_buffer_cyclic()
+{
+ if (info->partial_bitmap1 != NULL){
+ free(info->partial_bitmap1);
+ info->partial_bitmap1 = NULL;
+ }
+}
+
+void
+free_bitmap2_buffer_cyclic()
+{
+ if (info->partial_bitmap2 != NULL){
+ free(info->partial_bitmap2);
+ info->partial_bitmap2 = NULL;
+ }
+}
+
+void
+free_bitmap_buffer_cyclic()
+{
+ free_bitmap1_buffer_cyclic();
+ free_bitmap2_buffer_cyclic();
+}
+
int
create_dump_bitmap(void)
{
@@ -5147,8 +5172,7 @@ create_dump_bitmap(void)
goto out;
info->num_dumpable = get_num_dumpable_cyclic();
-
- free_bitmap2_buffer();
+ free_bitmap2_buffer_cyclic();
}
} else {
@@ -6190,6 +6214,8 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
if (!write_cache_bufsz(cd_page))
return FALSE;
+ free_bitmap_buffer_cyclic();
+
/*
* print [100 %]
*/
@@ -6947,7 +6973,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d
}
- free_bitmap1_buffer();
+ free_bitmap1_buffer_cyclic();
if (!prepare_bitmap2_buffer_cyclic())
return FALSE;
@@ -6970,7 +6996,7 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d
return FALSE;
}
-
+ free_bitmap2_buffer_cyclic();
gettimeofday(&tv_start, NULL);
@@ -9349,10 +9375,6 @@ out:
free(info->splitting_info);
if (info->p2m_mfn_frame_list != NULL)
free(info->p2m_mfn_frame_list);
- if (info->partial_bitmap1 != NULL)
- free(info->partial_bitmap1);
- if (info->partial_bitmap2 != NULL)
- free(info->partial_bitmap2);
free(info);
}
free_elf_info();

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jun 16 07:49:20 UTC 2014 - ptesarik@suse.cz
- makedumpfile-fix-free-bitmap_buffer_cyclic.patch: Fix free
bitmap_buffer_cyclic error.
-------------------------------------------------------------------
Fri Jun 13 10:00:24 UTC 2014 - ptesarik@suse.cz

View File

@@ -52,6 +52,7 @@ Patch1: %{name}-generic-multi-page-excl.patch
Patch2: %{name}-remove-overrun-adj.patch
Patch3: %{name}-isCompoundHead.patch
Patch4: %{name}-exclude-compound-pages.patch
Patch5: %{name}-fix-free-bitmap_buffer_cyclic.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 x86_64 ia64 ppc ppc64 ppc64le s390x %arm
@@ -74,6 +75,7 @@ Authors:
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
LIBS_STATIC=