Skip to content

Commit

Permalink
[S390] cio: fix memleak in resume path
Browse files Browse the repository at this point in the history
If a ccwdevice is lost during hibernation and a different
ccwdevice is attached to the same subchannel, we will
deregister the old ccw device and register the new one.

Since deregistration is not allowed in this context, we
handle this action later. However, some parts of the
registration process for the new device were started anyway,
so that the old device structure is no longer accessible.

Fix this by deferring both actions to the afterwards
scheduled subchannel event.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Oct 25, 2010
1 parent f277707 commit 74b6127
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/s390/cio/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,9 +1468,13 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
goto out;
break;
case IO_SCH_UNREG_ATTACH:
if (cdev->private->flags.resuming) {
/* Device will be handled later. */
rc = 0;
goto out;
}
/* Unregister ccw device. */
if (!cdev->private->flags.resuming)
ccw_device_unregister(cdev);
ccw_device_unregister(cdev);
break;
default:
break;
Expand Down

0 comments on commit 74b6127

Please sign in to comment.