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

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