Blame SOURCES/0036-libparted-Remove-fdasd-geometry-code-from-alloc_meta.patch

7fd79c
From 02178bf3980410abdd57c9f1045ff27bc4f11d7e Mon Sep 17 00:00:00 2001
7fd79c
From: "Brian C. Lane" <bcl@redhat.com>
7fd79c
Date: Mon, 11 Apr 2016 15:10:51 -0700
7fd79c
Subject: [PATCH 36/36] libparted: Remove fdasd geometry code from
7fd79c
 alloc_metadata (#1244833)
7fd79c
7fd79c
commit db20944f changed how the trailing_metadata_end is calculated in
7fd79c
dasd_alloc_metadata, removing the need for setting up the anchor struct.
7fd79c
But dasd_alloc_metadata can be called in various contexts, and the
7fd79c
arch_specific->fd may or may not be valid during these calls. This can
7fd79c
result in unpredictable crashes when it uses a stale fd and tries to run
7fd79c
the file image code in fdasd_get_geometry instead of the device code.
7fd79c
7fd79c
The solution is to just drop the unneeded code, and to remember that
7fd79c
arch_specific->fd should only be used when ped_device_open has first
7fd79c
been called.
7fd79c
7fd79c
Resolves: rhbz#1244833
7fd79c
(cherry picked from commit 9da2f460bebf9a8281fdd52536d3676b0914b8fd)
7fd79c
---
7fd79c
 libparted/labels/dasd.c | 4 ----
7fd79c
 1 file changed, 4 deletions(-)
7fd79c
7fd79c
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
7fd79c
index bb32d66..f79a867 100644
7fd79c
--- a/libparted/labels/dasd.c
7fd79c
+++ b/libparted/labels/dasd.c
7fd79c
@@ -948,7 +948,6 @@ dasd_alloc_metadata (PedDisk* disk)
7fd79c
 	PedPartition* part = NULL; /* initialize solely to placate gcc */
7fd79c
 	PedPartition* new_part2;
7fd79c
 	PedSector trailing_meta_start, trailing_meta_end;
7fd79c
-	struct fdasd_anchor anchor;
7fd79c
 
7fd79c
 	PED_ASSERT (disk != NULL);
7fd79c
 	PED_ASSERT (disk->dev != NULL);
7fd79c
@@ -998,10 +997,7 @@ dasd_alloc_metadata (PedDisk* disk)
7fd79c
 	      backed up, then restored to a larger size disk, etc.
7fd79c
 	   */
7fd79c
 	   trailing_meta_start = part->geom.end + 1;
7fd79c
-	   fdasd_initialize_anchor(&anchor);
7fd79c
-	   fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd);
7fd79c
 	   trailing_meta_end = (long long) disk->dev->length - 1;
7fd79c
-	   fdasd_cleanup(&anchor);
7fd79c
 	   if (trailing_meta_end >= trailing_meta_start) {
7fd79c
 		new_part2 = ped_partition_new (disk,PED_PARTITION_METADATA,
7fd79c
 		   NULL, trailing_meta_start, trailing_meta_end);
7fd79c
-- 
7fd79c
2.5.5
7fd79c