]> git.pld-linux.org Git - packages/parted.git/blame - 0024-fdasd.c-Safeguard-against-geometry-misprobing.patch
- release 6 (by relup.sh)
[packages/parted.git] / 0024-fdasd.c-Safeguard-against-geometry-misprobing.patch
CommitLineData
c886eb9d
AM
1From 953f340c3e24c296e9e73f4a0b45ff6563359592 Mon Sep 17 00:00:00 2001
2From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
3Date: Fri, 5 Feb 2016 14:47:11 +0100
4Subject: [PATCH] fdasd.c: Safeguard against geometry misprobing
5
6Fixes an issue with parted print being run against a logical
7volume realised by extents on a physical volume residing on
8a DASD.
9We must make sure that geometry, device blocksize and DASD
10attributes are present before we start format verifications
11If any of it is missing this is not a DASD.
12
13Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
14Signed-off-by: Brian C. Lane <bcl@redhat.com>
15---
16 libparted/labels/fdasd.c | 11 +++++++++--
17 1 file changed, 9 insertions(+), 2 deletions(-)
18
19diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
20index 7e6a77a..968b332 100644
21--- a/libparted/labels/fdasd.c
22+++ b/libparted/labels/fdasd.c
23@@ -1021,13 +1021,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f)
24 goto error;
25 }
26
27- if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
28+ if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0 ||
29+ anc->geo.heads == 0 ||
30+ anc->geo.sectors == 0 ||
31+ anc->geo.cylinders == 0 ) {
32 fdasd_error(anc, unable_to_ioctl,
33 _("Could not retrieve disk geometry information."));
34+ goto error;
35+ }
36
37- if (ioctl(f, BLKSSZGET, &blksize) != 0)
38+ if (ioctl(f, BLKSSZGET, &blksize) != 0) {
39 fdasd_error(anc, unable_to_ioctl,
40 _("Could not retrieve blocksize information."));
41+ goto error;
42+ }
43
44 /* get disk type */
45 if (ioctl(f, BIODASDINFO, &dasd_info) != 0) {
46--
472.5.0
48
This page took 0.028565 seconds and 4 git commands to generate.