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

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