1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
From 056d2d93505e5d96273517524721e4cb45c30e9f Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Date: Fri, 5 Feb 2016 14:47:11 +0100
Subject: fdasd.c: Safeguard against geometry misprobing
Fixes an issue with parted print being run against a logical
volume realised by extents on a physical volume residing on
a DASD.
We must make sure that geometry, device blocksize and DASD
attributes are present before we start format verifications
If any of it is missing this is not a DASD.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
Origin: upstream, http://git.savannah.gnu.org/cgit/parted.git/commit?id=8c6de55e4375bd63ae0d0dc7dd7104a7c2290cac
Bug-Debian: https://bugs.debian.org/814076
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1541510
Last-Update: 2016-02-10
Patch-Name: fdasd-check-geometry.patch
---
libparted/labels/fdasd.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index 7e6a77a2..968b3320 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -1021,13 +1021,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
goto error;
}
- if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
+ if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0 ||
+ anc->geo.heads == 0 ||
+ anc->geo.sectors == 0 ||
+ anc->geo.cylinders == 0 ) {
fdasd_error(anc, unable_to_ioctl,
_("Could not retrieve disk geometry information."));
+ goto error;
+ }
- if (ioctl(f, BLKSSZGET, &blksize) != 0)
+ if (ioctl(f, BLKSSZGET, &blksize) != 0) {
fdasd_error(anc, unable_to_ioctl,
_("Could not retrieve blocksize information."));
+ goto error;
+ }
/* get disk type */
if (ioctl(f, BIODASDINFO, &dasd_info) != 0) {
|