From: Hans-Joachim Picht <hpicht@redhat.com> Date: Fri, 16 Nov 2007 13:55:50 +0100 Subject: [s390] cio: Disable chan path measurements on reboot Message-id: 20071116125550.GM6053@redhat.com O-Subject: [RHEL5 U2 PATCH 5/14] s390 - cio: Disable channel path measurements on shutdown/reboot. Bugzilla: 354801 Description ============ This patch fixes memory corruptions if channel path measurements have been used on machine in the past. When channel path measurements are enabled, the channel subsystem is handed a memory area it can write to. If channel path measurements are not disabled before reboot, the channel subsystem will continue to write to those areas if no subsystem reset happened. The problem is fixed by disabling channel path measurements via a reboot notifier if they are still enabled. Bugzilla ========= BZ 354801 https://bugzilla.redhat.com/show_bug.cgi?id=354801 Upstream status of the patch: ============================= Patch is fixed upstream in commt a55360df406cca797ac07d722688dd7ec29bf46e. Test status: ============ Kernel with patch was built and successfully tested Please ACK. With best regards, Hans diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index e822faa..8cc2653 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -13,6 +13,7 @@ #include <linux/slab.h> #include <linux/errno.h> #include <linux/list.h> +#include <linux/reboot.h> #include "css.h" #include "cio.h" @@ -589,6 +590,25 @@ setup_css(int nr) css_generate_pgid(css[nr], tod_high); } +static int css_reboot_event(struct notifier_block *this, + unsigned long event, + void *ptr) +{ + int ret, i; + + ret = 0; + for (i = 0; i <= __MAX_CSSID && !ret; i++) { + if (css[i]->cm_enabled) + ret = chsc_secm(css[i], 0); + } + + return ret ? NOTIFY_BAD : NOTIFY_DONE; +} + +static struct notifier_block css_reboot_notifier = { + .notifier_call = css_reboot_event, +}; + /* * Now that the driver core is running, we can setup our channel subsystem. * The struct subchannel's are created during probing (except for the @@ -635,12 +655,17 @@ init_channel_subsystem (void) goto out_device; } } + ret = register_reboot_notifier(&css_reboot_notifier); + if (ret) + goto out_file; css_init_done = 1; ctl_set_bit(6, 28); for_each_subchannel(__init_channel_subsystem, NULL); return 0; +out_file: + device_remove_file(&css[i]->device, &dev_attr_cm_enable); out_device: device_unregister(&css[i]->device); out_free: