aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_devmap.c
diff options
context:
space:
mode:
authorStefan Haberland <stefan.haberland@de.ibm.com>2010-02-26 16:37:47 -0500
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2010-02-26 16:37:32 -0500
commit589c74d5076dd1bde13a5a36d97ca79be8bd72b2 (patch)
tree252349a17326853d7e026b357921da6192958d26 /drivers/s390/block/dasd_devmap.c
parent9eb251225ab4dbea3119cfcf4c5194eed223a740 (diff)
[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 <stefan.haberland@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r--drivers/s390/block/dasd_devmap.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 4cac5b54f26a..d49766f3b940 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,
874 ssize_t len; 874 ssize_t len;
875 875
876 device = dasd_device_from_cdev(to_ccwdev(dev)); 876 device = dasd_device_from_cdev(to_ccwdev(dev));
877 if (!IS_ERR(device) && device->discipline) { 877 if (IS_ERR(device))
878 goto out;
879 else if (!device->discipline) {
880 dasd_put_device(device);
881 goto out;
882 } else {
878 len = snprintf(buf, PAGE_SIZE, "%s\n", 883 len = snprintf(buf, PAGE_SIZE, "%s\n",
879 device->discipline->name); 884 device->discipline->name);
880 dasd_put_device(device); 885 dasd_put_device(device);
881 } else 886 return len;
882 len = snprintf(buf, PAGE_SIZE, "none\n"); 887 }
888out:
889 len = snprintf(buf, PAGE_SIZE, "none\n");
883 return len; 890 return len;
884} 891}
885 892