From: Sebastian Ott Date: Mon, 25 Oct 2010 14:10:26 +0000 (+0200) Subject: [S390] cio: fix memleak in resume path X-Git-Tag: firefly_0821_release~7613^2~3648^2~28 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=74b6127e6c35abf06364468636dd261850639f8b;p=firefly-linux-kernel-4.4.55.git [S390] cio: fix memleak in resume path 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 Signed-off-by: Martin Schwidefsky --- diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 51bd3687d163..07b1a074beaf 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -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;