summaryrefslogtreecommitdiff
path: root/drivers/s390/cio/device.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2012-09-05 16:20:41 +0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-09-06 12:40:40 +0400
commit3368ba25bf387109b24732c1e270c628f20e345d (patch)
treea699ca6bdb68c241d89685ff81f60adeae81f7ed /drivers/s390/cio/device.c
parent43d0be75af8d05654b88d1da494cf292714fbdec (diff)
downloadlinux-3368ba25bf387109b24732c1e270c628f20e345d.tar.xz
s390/cio: invalidate cdev pointer before deregistration
Make sure that the cdev pointer for IO subchannels is set to NULL when we deregister the device (and release its last reference). This will fix a bug were another process operates on an already freed ccw device. Acked-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/device.c')
-rw-r--r--drivers/s390/cio/device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index e8e1a108cdf8..fc916f5d7314 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -1521,11 +1521,14 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
goto out;
break;
case IO_SCH_UNREG_ATTACH:
+ spin_lock_irqsave(sch->lock, flags);
if (cdev->private->flags.resuming) {
/* Device will be handled later. */
rc = 0;
- goto out;
+ goto out_unlock;
}
+ sch_set_cdev(sch, NULL);
+ spin_unlock_irqrestore(sch->lock, flags);
/* Unregister ccw device. */
ccw_device_unregister(cdev);
break;