From 589c74d5076dd1bde13a5a36d97ca79be8bd72b2 Mon Sep 17 00:00:00 2001 From: Stefan Haberland Date: Fri, 26 Feb 2010 22:37:47 +0100 Subject: [S390] dasd: fix refcounting. The function dasd_device_from_cdev returns a reference to the dasd device and increases the refcount by one. If an exception occurs, the refcount was not decreased in all cases e.g. in dasd_discipline_show. Prevent the offline processing from hang by correcting two functions to decrease the refcount even if an error occured. Signed-off-by: Stefan Haberland Signed-off-by: Martin Schwidefsky --- drivers/s390/block/dasd_devmap.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'drivers/s390/block/dasd_devmap.c') diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 4cac5b54f26..d49766f3b94 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -874,12 +874,19 @@ dasd_discipline_show(struct device *dev, struct device_attribute *attr, ssize_t len; device = dasd_device_from_cdev(to_ccwdev(dev)); - if (!IS_ERR(device) && device->discipline) { + if (IS_ERR(device)) + goto out; + else if (!device->discipline) { + dasd_put_device(device); + goto out; + } else { len = snprintf(buf, PAGE_SIZE, "%s\n", device->discipline->name); dasd_put_device(device); - } else - len = snprintf(buf, PAGE_SIZE, "none\n"); + return len; + } +out: + len = snprintf(buf, PAGE_SIZE, "none\n"); return len; } -- cgit v1.2.3