summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorStefan Haberland <sth@linux.vnet.ibm.com>2017-01-25 16:56:41 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-01-31 10:47:25 +0100
commitca732e111ff7017e79a0cbb8aa0636c6ce48eb7d (patch)
tree7097bbd9bf7f90edefde0fed88ffdb8bcd582618 /drivers/s390
parent2202134e48a3b50320aeb9e3dd1186833e9d7e66 (diff)
downloadlinux-ca732e111ff7017e79a0cbb8aa0636c6ce48eb7d.tar.bz2
s390/dasd: check blockdevice pointer before trying to sync blockdevice
If safe offline is called for a DASD alias device a null pointer is passed to fsync_bdev. So check for existence of the blockdevice before calling fsync_bdev. Should not be a real world problem since safe offline for an alias device does not make sense and fsync_bdev can deal with a NULL pointer which it gets after successful NULL pointer dereferencing on s390. Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/block/dasd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index f3099c8cc143..6fb3fd5efc11 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -3601,10 +3601,11 @@ int dasd_generic_set_offline(struct ccw_device *cdev)
* empty
*/
/* sync blockdev and partitions */
- rc = fsync_bdev(device->block->bdev);
- if (rc != 0)
- goto interrupted;
-
+ if (device->block) {
+ rc = fsync_bdev(device->block->bdev);
+ if (rc != 0)
+ goto interrupted;
+ }
/* schedule device tasklet and wait for completion */
dasd_schedule_device_bh(device);
rc = wait_event_interruptible(shutdown_waitq,