Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3120

kernel-2.6.18-194.11.1.el5.src.rpm

From: Hans-Joachim Picht <hpicht@redhat.com>
Date: Thu, 7 Aug 2008 13:18:12 +0200
Subject: [s390] dasd: oops when Hyper PAV alias is set online
Message-id: 20080807111812.GE6319@redhat.com
O-Subject: [RHEL5 U3 PATCH 5/5] s390 - dasd: prevent oops when Hyper PAV alias is set online
Bugzilla: 458155
RH-Acked-by: Jarod Wilson <jwilson@redhat.com>
RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com>

Description
============

When a hyper PAV alias is set online by a kernel that does not
support hyper PAV, the unexpected lack of disk geometry data
leads to devision by zero errors.

When the DASD device driver sets an ECKD device online, it reads
the device characteristics which include information about the
disk geometry. When this geometry data is not available it will
lead to follow on problems like devision by zero.
A kernel that does not support Hyper PAV should never sees such
an alias, but it can happen in a z/VM guest with a wrong
PAV configuration.

Solution: Check the disk geometry information and do not allow to enable
a device that doesn't have any.

Bugzilla
=========

BZ 458155
https://bugzilla.redhat.com/show_bug.cgi?id=458155

Upstream status of the patch:
=============================
The patch was not posted upstream, because the code there has been changed in
the meantime and does not affect the upstream code base.

Test status:
============

The patch has been tested and fixes the problem.
The fix has been verified by the IBM test department.

Please ACK.

With best regards,

	-Hans

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 2ea8bf3..ddbba8a 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -805,6 +805,17 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
 		    private->rdc_data.no_cyl,
 		    private->rdc_data.trk_per_cyl,
 		    private->rdc_data.sec_per_trk);
+	/*
+	 * Can't handle devices that have no proper cylinder or track
+	 * numbers, e.g. hyper PAV alias devices.
+	 */
+	if (!private->rdc_data.no_cyl || !private->rdc_data.trk_per_cyl) {
+		DEV_MESSAGE(KERN_WARNING, device, "%s",
+			    "Cannot online device that reports no cylinder or"
+			    " head information.");
+		return -EOPNOTSUPP;
+	}
+
 	return rc;
 }