|
|
0cb0b9 |
From 953f340c3e24c296e9e73f4a0b45ff6563359592 Mon Sep 17 00:00:00 2001
|
|
|
0cb0b9 |
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
0cb0b9 |
Date: Fri, 5 Feb 2016 14:47:11 +0100
|
|
|
0cb0b9 |
Subject: [PATCH] fdasd.c: Safeguard against geometry misprobing
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
Fixes an issue with parted print being run against a logical
|
|
|
0cb0b9 |
volume realised by extents on a physical volume residing on
|
|
|
0cb0b9 |
a DASD.
|
|
|
0cb0b9 |
We must make sure that geometry, device blocksize and DASD
|
|
|
0cb0b9 |
attributes are present before we start format verifications
|
|
|
0cb0b9 |
If any of it is missing this is not a DASD.
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
0cb0b9 |
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
0cb0b9 |
---
|
|
|
0cb0b9 |
libparted/labels/fdasd.c | 11 +++++++++--
|
|
|
0cb0b9 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
|
|
|
0cb0b9 |
index 7e6a77a..968b332 100644
|
|
|
0cb0b9 |
--- a/libparted/labels/fdasd.c
|
|
|
0cb0b9 |
+++ b/libparted/labels/fdasd.c
|
|
|
0cb0b9 |
@@ -1021,13 +1021,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
|
|
|
0cb0b9 |
goto error;
|
|
|
0cb0b9 |
}
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
- if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
|
|
|
0cb0b9 |
+ if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0 ||
|
|
|
0cb0b9 |
+ anc->geo.heads == 0 ||
|
|
|
0cb0b9 |
+ anc->geo.sectors == 0 ||
|
|
|
0cb0b9 |
+ anc->geo.cylinders == 0 ) {
|
|
|
0cb0b9 |
fdasd_error(anc, unable_to_ioctl,
|
|
|
0cb0b9 |
_("Could not retrieve disk geometry information."));
|
|
|
0cb0b9 |
+ goto error;
|
|
|
0cb0b9 |
+ }
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
- if (ioctl(f, BLKSSZGET, &blksize) != 0)
|
|
|
0cb0b9 |
+ if (ioctl(f, BLKSSZGET, &blksize) != 0) {
|
|
|
0cb0b9 |
fdasd_error(anc, unable_to_ioctl,
|
|
|
0cb0b9 |
_("Could not retrieve blocksize information."));
|
|
|
0cb0b9 |
+ goto error;
|
|
|
0cb0b9 |
+ }
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
/* get disk type */
|
|
|
0cb0b9 |
if (ioctl(f, BIODASDINFO, &dasd_info) != 0) {
|
|
|
0cb0b9 |
--
|
|
|
0cb0b9 |
2.5.0
|
|
|
0cb0b9 |
|