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

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