Skip to contentSkip to conversation

s390/dasd: Fix the leak of references on DASD discipline module

PATCH New Eduard Shishkin 1 participant 1 message Jul 17

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/dasd: Fix the leak of references on DASD discipline module

In dasd_destroy_partitions() instead of fput() use its synchronous version __fput_sync(). Otherwise, dasd_delete_device() can be called before dasd_release(), which makes the last one not release the captured resources, as the associated dasd_device doesn't longer exist. In particular, the reference to dasd_eckd_mod is not dropped, reasons why the module cannot be unloaded.
Steps to reproduce the problem:

\# lsmod | grep dasd
dasd_eckd_mod 180224 0
\# echo 1 > /sys/bus/ccw/devices/0.0.ef01/online
\# echo 0 > /sys/bus/ccw/devices/0.0.ef01/online
\# lsmod | grep dasd
dasd_eckd_mod 180224 1

Fixes c8e108d80cd8 ("s390: port block device access to file")
---
 drivers/s390/block/dasd_genhd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/block/dasd_genhd.c +1 -1
index 930b47acdb8d..8a878c346799 100644
@@ -213,7 +213,7 @@ void dasd_destroy_partitions(struct dasd_block *block)
 	mutex_unlock(&file_bdev(bdev_file)->bd_disk->open_mutex);
 
 	/* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
-	fput(bdev_file);
+	__fput_sync(bdev_file);
 }
 
 int dasd_gendisk_init(void)
Signature · 1 line
2.48.1