mirror of
https://github.com/torvalds/linux.git
synced 2026-05-01 04:52:32 -04:00
[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>
This commit is contained in:
committed by
Martin Schwidefsky
parent
9eb251225a
commit
589c74d507
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user