- fdasd.c Safeguard against geometry misprobing.patch (#1305931)

This commit is contained in:
Brian C. Lane 2016-02-09 17:48:28 -08:00
parent b6f7bbc110
commit ed6adbba63
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From 953f340c3e24c296e9e73f4a0b45ff6563359592 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: [PATCH] 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>
---
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 7e6a77a..968b332 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) {
--
2.5.0

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.2
Release: 14%{?dist}
Release: 15%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -37,6 +37,7 @@ Patch0020: 0020-tests-Use-wait_for_dev_to_-functions.patch
Patch0021: 0021-fdasd-geometry-handling-updated-from-upstream-s390-t.patch
Patch0022: 0022-dasd-enhance-device-probing.patch
Patch0023: 0023-parted-fix-build-error-on-s390.patch
Patch0024: 0024-fdasd.c-Safeguard-against-geometry-misprobing.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -179,6 +180,9 @@ fi
%changelog
* Tue Feb 09 2016 Brian C. Lane <bcl@redhat.com> 3.2-15
- fdasd.c Safeguard against geometry misprobing.patch (#1305931)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild