Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dasd: fix sysfs cleanup in dasd_generic_remove

When the DASD devices are detached from the driver, then the
dasd_generic_remove function is called. One of the things this
function should do is to remove the DASD specific sysfs attributes,
but this is not done in all cases. This is likely to cause an oops
when at a later point sysfs stumbles over the stale pointers. In
particular this happens when when the modules are unloaded and loaded
again.

Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Stefan Weinhuber and committed by
Martin Schwidefsky
be4904e5 53923354

+4 -1
+4 -1
drivers/s390/block/dasd.c
··· 3042 3042 cdev->handler = NULL; 3043 3043 3044 3044 device = dasd_device_from_cdev(cdev); 3045 - if (IS_ERR(device)) 3045 + if (IS_ERR(device)) { 3046 + dasd_remove_sysfs_files(cdev); 3046 3047 return; 3048 + } 3047 3049 if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) && 3048 3050 !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { 3049 3051 /* Already doing offline processing */ 3050 3052 dasd_put_device(device); 3053 + dasd_remove_sysfs_files(cdev); 3051 3054 return; 3052 3055 } 3053 3056 /*