2008-03-05 11:59:27

by Martin Schwidefsky

[permalink] [raw]
Subject: [patch 05/10] dasd: fix reference counting in display method for proc/dasd/devices

From: Stefan Weinhuber <[email protected]>

Using the /proc/dasd/devices interface leaves the reference counter
of alias devices in an inconsistent state. A process that tries to set
such a device offline afterwards will hang.
The dasd_devices_show function returns immediately for alias devices
and this code path was missing a dasd_put_device call.

Signed-off-by: Stefan Weinhuber <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
---

drivers/s390/block/dasd_proc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: quilt-2.6/drivers/s390/block/dasd_proc.c
===================================================================
--- quilt-2.6.orig/drivers/s390/block/dasd_proc.c
+++ quilt-2.6/drivers/s390/block/dasd_proc.c
@@ -62,8 +62,10 @@ dasd_devices_show(struct seq_file *m, vo
return 0;
if (device->block)
block = device->block;
- else
+ else {
+ dasd_put_device(device);
return 0;
+ }
/* Print device number. */
seq_printf(m, "%s", device->cdev->dev.bus_id);
/* Print discipline string. */

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.