Skip to content

Commit

Permalink
dasd: fix sysfs cleanup in dasd_generic_remove
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Weinhuber authored and Martin Schwidefsky committed Feb 14, 2013
1 parent 5392335 commit be4904e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/s390/block/dasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3042,12 +3042,15 @@ void dasd_generic_remove(struct ccw_device *cdev)
cdev->handler = NULL;

device = dasd_device_from_cdev(cdev);
if (IS_ERR(device))
if (IS_ERR(device)) {
dasd_remove_sysfs_files(cdev);
return;
}
if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) &&
!test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) {
/* Already doing offline processing */
dasd_put_device(device);
dasd_remove_sysfs_files(cdev);
return;
}
/*
Expand Down

0 comments on commit be4904e

Please sign in to comment.